ActiveCollab API - No Description on API time-records commands - activecollab

ActiveCollab v5.13 - The time-record input form on the website has 6 fields including "description". The API documentation has the other 5 but "description" is nowhere to be found in the documentation.
I want to automate time-record data entry but ... no description.
In the API, what is the parameter name of the time record description?
The fields on the input screen:
Time
Description
Job Type
Date
Task
Billable
The fields on the /projects/(number)/time-records command (copied from the API documentation:
{
"value": 1.5,
"user_id": 1,
"job_type_id": 1,
"record_date": "2014-05-14",
"billable_status": 0
}
API Documentation

Descriptions are returned in the API (docs are not up to date). Here's a sample from the call made by the system:
billable_status: 1
class: "TimeRecord"
created_by_id: 44
created_on: 1496929240
id: 5275
is_trashed: false
job_type_id: 1
parent_id: 52314
parent_type: "Task"
record_date: 1496880000
summary: ""
trashed_by_id: 0
trashed_on: null
updated_by_id: 44
updated_on: 1496929240
url_path: "/projects/204/time-records/5275"
user_id: 44
value: 1
It's summary that you are looking for.

Related

Microsoft Graph update SharePoint list item multi choice field

What is the proper JSON syntax to update a multi-choice list item field using the Microsoft Graph?
Multi choice fields return a json array of strings like:
GET: /v1.0/sites/{siteId}/lists/{listId}/items/{itemId}
"CAG_x0020_Process_x0020_Status": [
"Proposed Funding - Customer Billed",
"Proposed Funding - Sales Funded",
"SOW - Needed"
]
However, when using the same syntax to update the field a 400 invalid request is returned.
PATCH: /v1.0/sites/{siteId}/lists/{listId}/items/{itemId}/fields
"CAG_x0020_Process_x0020_Status": [
"Proposed Funding - Customer Billed",
"Proposed Funding - Sales Funded",
"SOW - Needed"
]
Error returned:
{
"error": {
"code": "invalidRequest",
"message": "The request is malformed or incorrect.",
"innerError": {
"request-id": "2251e25f-e4ce-491f-beb9-e463c7d8d5af",
"date": "2018-05-16T15:16:23"
}
}
}
I am able to update all other fields requested, but this last field is holding up a release of the application.
To elaborate on what #muhammad-obaidullah-ather wrote in the comments, for string multiple choices you need to define the type as Collection(Edm.String) and then his solutions works for me. Repeating what he wrote as complete answer.
This should be sent as a PATCH like this:
PATCH /v1.0/sites/{SiteId}/lists/{ListId}/items/{ItemId}/fields
{"*FieldName*#odata.type":"Collection(Edm.String)","*FieldName*":["*Value1*","*Value2*"]}
This works for me
graph.api(url)
.version('beta')
.post({
'fields': {
'AssignedToLookupId#odata.type': 'Collection(Edm.Int32)',
'AssignedToLookupId': [5,13]
}
});
Unfortunately, a number of column types, including MultiChoice, cannot be updated via Microsoft Graph today. I would recommend adding this to the Office Dev UserVoice so it remains on the radar of the SharePoint/Graph team.

Publish a google spreadsheet as json

The Sheetsee library uses google spreadsheets as a data backend. I'm trying to publish my google spreadsheet as json so that I can access it using the Sheetsee library. The current 'Publish to the web' function available in google docs doesn't show any option to publish the data as json. Is this something that has been removed from Google Spreadsheets or is it available somewhere else in google docs?
First, you must publish your spreadsheet to the web, using File -> Publish To Web in your Google Spreadsheet.
You can then access your readable JSON API using the /api endpoint.
http://gsx2json.com/api?id=SPREADSHEET_ID&sheet=SHEET_NUMBER&q=QUERY
This will update live with changes to the spreadsheet.
Parameters :
id (required): The ID of your document. This is the big long aplha-numeric code in the middle of your document URL.
sheet (optional): The number of the individual sheet you want to get data from. Your first sheet is 1, your second sheet is 2, etc. If no sheet is entered then 1 is the default. Example
q (optional): A simple query string. This is case insensitive and will add any row containing the string in any cell to the filtered result. Example
integers (optional - default: true): Setting 'integers' to false will return numbers as a string (useful for decimal points). Example
rows (optional - default: true): Setting 'rows' to false will return only column data. Example
columns (optional - default: true): Setting 'columns' to false will return only row data.
Example Response:-
There are two sections to the returned data - Columns (containing each column as a data array), and Rows (containing each row of data as an object.
{
columns: {
name: [
"Nick",
"Chris",
"Barry"
],
age: [
21,
27,
67;
]
},
rows: [
{
name: "Nick",
age: 21
},
{
name: "Chris",
age: 27
},
{
name: "Barry",
age: 67
}
]
}
src="http://gsx2json.com/"

SAPUI5 TreeTable - flat OData

i have an issue or lack of idea how to build TreeTable from flat OData data. The data looks like this (columns):
Document Number,
Year,
Month,
Status,
several more columns
The hierarchy should like like this:
DOCUMENT
`- YEAR
`- Month
`- STATUS 1
- data for status 1 #1
- data for status 1 #2
`- STATUS 2
- data for status 2 #1
- data for status 2 #2
ODATA returns:
DOCUMENT | YEAR | MONTH | STATUS1 | Data for status 1 #1
DOCUMENT | YEAR | MONTH | STATUS1 | Data for status 1 #1
DOCUMENT | YEAR | MONTH | STATUS2 | Data for status 2 #1
DOCUMENT | YEAR | MONTH | STATUS2 | Data for status 2 #2
The question would be - is there any callback function/whatever i could use in order to reorganize the data for example by putting it in JSON format ? Or any other Idea ?
I have a CDS View and generated OData behind, so need to do this in UI5.
Any help would be highly appreciated !
Cheers
Kubas
If as you said there should be an edit possibility for the table, you can use a stanard TreeTable OData binding, but the backend must provide you the hierarchical data (it will cost nothing to implement the editability due to standard two-way binding), in your case the OData structure will look like this:
[
{
ID: "",
NodeID: 1,
type: "document",
title: "",
HierarchyLevel: 1,
ParentNodeID: null
},
{
ID: "",
NodeID: 2,
type: "year",
title: "",
HierarchyLevel: 2,
ParentNodeID: 1
},
{
ID: "",
NodeID: 3,
type: "month",
title: "",
HierarchyLevel: 3,
ParentNodeID: 2
},
{
ID: "",
NodeID: 4,
type: "status",
title: "",
HierarchyLevel: 4,
ParentNodeID: 3
},
{
ID: "",
NodeID: 5,
type: "data for status",
data: {},
title: "",
HierarchyLevel: 5,
ParentNodeID: 4
}
]
If there is no chance for the backend to provide such structure, you can parse your backend response and construct JSON model (the parsing will be just for a grouping reasons, you need to group your flat structure into the hierarchical considering the keys: document ids, years, months, statuses..).
JSON data structure:
[
{
DocumentId: "",
items: [
{
year: "",
items: [
{
month: "",
items: [
{
status: ""
}
]
}
]
}
]
}
]
But this JSON-approach makes harder to track the changes to be send to the backend side. So the task is to find the nodes that were changed by the user and here you can think about making the diff between original parsed data and the data in a state after the changes applied by the user. Or you can keep a kind of a map of the changes user made to the document id's and turn this data into the odata calls once user wants to submit the changes.
UPD 1:
Implementation of "lazy loading" for the tree structure that is defined by the flat one (via backend) will be problematic. Because to my understanding, the lazy loading for the tree will look like the following:
initially UI loads all the items from the 1-st level. Then after clicking on the "expand" button of th 1st level, UI makes a call to fetch the 2nd level and so on.
The lazy loading for the "flat" list works differently, while user scrolling the table down and reaches the very bottom side (based on the "threshold" property), table can request more data via new $skip & $top properties in OData call.
So I'm afraid that it won't be possible to make the lazy loading without property tree structure from backend.
Possible workaround might be providing a kind of a filter to reduce amount of items.
As to your question about "where to put this parsing" - you need to perform the "read" request manually in the controller, then in "success" method call the parsing, then construct JSONModel based on parsed data and finally bind the table to this model.

Use Google APIs to calculate the timezones of each location object and then return output as this same array of objects

1) a) You have a list of addresses. Use Google APIs to calculate the timezones of each location object and then return output as this same array of objects, with each object comprising of following values -
[{
"id":"1",
"address":"Plot 5, CDCL Building, Chandigarh"m
"latitude":"30.123123",
"longitude":"76.123213"
"timezone":"-330", //in minutes
"UTC_time":"2016-10-18 5:30:00 AM"
}]
b) Now write an algorithm, to divide this array into least no. of sub-arrays, such that difference between the minimum UTC_time and maximum UTC_time in that array is less than or equal to 4 hrs.
2) Parse the attached html file and generate a JSON file as output, which contains all the key
FORMAT
Test Duration- 5 Hours
Test Date -27 October,2016
Format to be send in : "Student name- college name -roll number- 2016"||
Email Id - kunal#tookanapp.com ( All the students need to send their test on the mentioned email ID in the mentioned format )
Start Time - 11.00 AM
End Time - 4.00 PM
Just go through this link.You will get the answer.
https://developers.google.com/maps/documentation/timezone/intro
This is an algorithm not a program::--
initialise i, ar [100],d ;
MAX UTC_time= +14:00(150°);
Min UTC_time=-12:00 (180°);
for min UTC_time initialise to -12:00;
min UTC_time <=+14:00
If min UTC_time > +10:00
Then d=max UTC _time - min UTC_time;
And then print d;
Else
Min UTC_time++;
Link is :--
https://maps.googleapis.com/maps/api/timezone/json?location=39.6034810,-119.6822510&timestamp=1331766000&key=YOUR_API_KEY
{
"dstOffset" : 0,
"rawOffset" : -28800,
"status" : "OK",
"timeZoneId" : "America/Los_Angeles",
"timeZoneName" : "Pacific Standard Time"
}
In html language......
OK
-28800.0000000
0.0000000
America/Los_Angeles
Pacific Standard Time
time_zone_name>

VersionOne: Report on Backlog Items, tasks, defects with Attachments in C# V1 API/JSON

How would you query VersionOne (V1) to build a report that contains (Backlog Items with assoicated tasks, defects and especially Attachments in C# for a given Project? Does anyone have C# V1 API/JSON example on how to do this? I need the the part that queries VersioOne and extracts the Attachment to a directory. I can do the reporting part.
Thanks,
Remy
I suggest using any C# HTTP library you like. Submit a query such as the following to ~/query.v1 . The query text may in a POST body or in a GET url parameter named query:
where:
Name: Whatever Project You Want
from: Scope
select:
- Name
- from: Workitems:PrimaryWorkitem
select:
- AssetType
- Number
- from: Attachments
select:
- Name
- Description
- ContentType
- Content
- from: Children:Task
select:
- Name
- Number
- AssetType
- from: Attachments
select:
- Name
- Description
- ContentType
- Content
Above, I select Attachment.Content which would yield a base64 blob in the output. The attachment content URLs are not present in any attribute that can be selected by query.v1, but you can create them by appending the Attachment id to ~/attachment.v1
Results will be returned in a straightforward hierarchical JSON response:
[
[
{
"_oid":"Scope:57460",
"Name":"openAgile",
"Workitems:PrimaryWorkitem": [
{
"_oid":"Story:83524",
"AssetType":"Story",
"Number":"S-08114",
"Attachments":[],
"Subs":[],
"Children:Task": [
{
"_oid":"Task:86578",
"Name":"Test Integration in Atlanta",
"Number":"TK-11051",
"AssetType":"Task"
},
{
"_oid":"Task:86581",
"Name":"Install In our Production environment",
"Number":"TK-11052",
"AssetType":"Task"
},
{
"_oid":"Task:86584",
"Name":"Document",
"Number":"TK-11053",
"AssetType":"Task"
}
]
},
]
}
]
]
You may also use the rest-1.v1 endpoint or our SDK library, but query.v1 is highly suggested for virtually any report or read-only query that it allows.