JSON syntax for GET/tasks with optional fields
We are trying to configure JSON request to replicate the results provided in the API documentation example (below) for GET all tasks (BOLD hightlights section of code we're struggling with). Can someone provide a simple example of JSON that would accomplish this?
curl -g -X GET -H 'Authorization: bearer eyJ0dCI6InAiLCJhbGciOiJIUzI1NiIsInR2IjoiMSJ9.eyJkIjoie1wiYVwiOjE2MDkxOTMsXCJpXCI6MjIyNjUwLFwiY1wiOjI2MTIxMzQsXCJ2XCI6XCJcIixcInVcIjoyMDYzMjQ2NDcsXCJyXCI6XCJVU1wiLFwic1wiOltcIk5cIixcIklcIixcIldcIixcIkZcIixcIktcIixcIlVcIixcIkNcIixcIkFcIixcIkxcIl0sXCJ6XCI6W10sXCJ0XCI6MTU2NDU5MTI0MjAwMH0iLCJleHAiOjE1NjQ1OTEyNDIsImlhdCI6MTU2NDU4NzY0Mn0.OyigUQaQAHDYsZljmN8nwt6eXBCCcW8D7pvq9p-UnbY' 'https://www.wrike.com/api/v4/tasks?metadata={"key":"testMetaKey","value":"testMetaValue"}&createdDate={"start":"2019-07-30T15:40:55Z"}&dueDate={"start":"2019-06-30"}&sortOrder=Desc&sortField=CreatedDate&scheduledDate={"start":"2019-06-30","end":"2019-08-31"}&updatedDate={"start":"2019-07-30T15:40:55Z","end":"2019-08-01T15:40:55Z"}&fields=["authorIds","briefDescription","dependencyIds","attachmentCount","description","customFields","metadata","responsibleIds","superParentIds","recurrent","hasAttachments","parentIds","sharedIds","superTaskIds","subTaskIds"]&descendants=true&startDate={"end":"2019-08-31T18:40:55"}&status=Active'
Same issue here. Using the same field parameter specified in the API, my returned tasks include *none* of the fields listed.
Scribe Connector
In your example curl, you've included some generic example keys for metadata. Try replacing the URL portion of your curl with:
https://www.wrike.com/api/v4/tasks?createdDate={"start":"2019-07-30T15:40:55Z"}&dueDate={"start":"2019-06-30"}&sortOrder=Desc&sortField=CreatedDate&scheduledDate={"start":"2019-06-30","end":"2019-08-31"}&updatedDate={"start":"2019-07-30T15:40:55Z","end":"2019-08-01T15:40:55Z"}&fields=["authorIds","briefDescription","dependencyIds","attachmentCount","description","customFields","metadata","responsibleIds","superParentIds","recurrent","hasAttachments","parentIds","sharedIds","superTaskIds","subTaskIds"]&descendants=true&startDate={"end":"2019-08-31T18:40:55"}&status=Active
This is an exact copy of your example, with just the metadata parameter removed, so it assumes you are intentionally filtering the tasks returned by including all of these filter parameters.
Thanks, Laura,
Here is the JSON that I came up with to define these filters for the Scribe Online solution I am working with. To use the filter parameters in Scribe, I use the statement below, where the "Id" of the custom field is: "IEACPQK2JUAA7RR6" and the value I'm filtering for is "Ultra Complex".
"/tasks": {
"get": {
"produces": [ "application/json" ],
"description": "Search among all tasks in all accounts.",
"parameters": [
{
"name": "descendants",
"in": "query",
"description": "Adds all descendant folders to search scope",
"required": false,
"type": "boolean"
},
{
"name": "title",
"in": "query",
"description": "Title filter, exact match",
"required": false,
"type": "string"
},
{
"name": "status",
"in": "query",
"description": "Status filter, match with any of specified constants",
"required": false,
"type": "string",
"enum": [ "Active", "Completed", "Deferred", "Cancelled" ]
},
{
"name": "importance",
"in": "query",
"description": "Importance filter, exact match.",
"required": false,
"type": "string",
"enum": [ "High", "Normal", "Low" ]
},
{
"name": "startDate",
"in": "query",
"description": "\nStart date filter, date match or range (Timestamp semi-open interval) \\n\n- start (Optional): Range start \\n\n- equal (Optional): Date exact match value \\n\n- end (Optional): Range end \\n\n\"Format: yyyy-MM-dd'T'HH:mm:ss'Z' ('T'HH:mm:ss is optional)\"\n",
"required": false,
"type": "string"
},
{
"name": "dueDate",
"in": "query",
"description": "\nDue date filter, date match or range (Timestamp semi-open interval) \\n\n- start (Optional): Range start \\n\n- equal (Optional): Date exact match value \\n\n- end (Optional): Range end \\n\n\"Format: yyyy-MM-dd'T'HH:mm:ss'Z' ('T'HH:mm:ss is optional)\"\n",
"required": false,
"type": "string"
},
{
"name": "scheduledDate",
"in": "query",
"description": "\nScheduled date filter, date match or range (Timestamp semi-open interval) \\n\n- start (Optional): Range start \\n\n- equal (Optional): Date exact match value \\n\n- end (Optional): Range end \\n\n\"Format: yyyy-MM-dd'T'HH:mm:ss'Z' ('T'HH:mm:ss is optional)\"\n",
"required": false,
"type": "string"
},
{
"name": "createdDate",
"in": "query",
"required": false,
"type": "string",
"x-example": "{\"start\":\"2019-10-07T12:04:48Z\",\"end\":\"2019-10-15T12:04:48Z\"}"
},
{
"name": "updatedDate",
"in": "query",
"description": "\nUpdated date filter, date match or range (Timestamp semi-open interval) \\n\n- start (Optional): Range start \\n\n- equal (Optional): Date exact match value \\n\n- end (Optional): Range end \\n\n\"Format: yyyy-MM-dd'T'HH:mm:ss'Z' ('T'HH:mm:ss is optional)\"\n",
"required": false,
"type": "string"
},
{
"name": "completedDate",
"in": "query",
"description": "\nCompleted date filter, date match or range (Timestamp semi-open interval) \\n\n- start (Optional): Range start \\n\n- equal (Optional): Date exact match value \\n\n- end (Optional): Range end \\n\n\"Format: yyyy-MM-dd'T'HH:mm:ss'Z' ('T'HH:mm:ss is optional)\"\n",
"required": false,
"type": "string"
},
{
"name": "authors",
"in": "query",
"required": false,
"type": "string",
"x-example": "[\"KUAFVCAD\"]"
},
{
"name": "responsibles",
"in": "query",
"description": "Responsibles filter, match of any",
"required": false,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "csv"
},
{
"name": "shareds",
"in": "query",
"description": "Shared users filter, match of any",
"required": false,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "csv"
},
{
"name": "permalink",
"in": "query",
"description": "Task permalink, exact match",
"required": false,
"type": "string"
},
{
"name": "type",
"in": "query",
"description": "Task type.",
"required": false,
"type": "string",
"enum": [ "Backlog", "Milestone", "Planned" ]
},
{
"name": "limit",
"in": "query",
"description": "Limit on number of returned tasks",
"required": false,
"type": "integer"
},
{
"name": "sortField",
"in": "query",
"description": "Sort field.",
"required": false,
"type": "string",
"enum": [ "CreatedDate", "UpdatedDate", "CompletedDate", "DueDate", "Status", "Importance", "Title" ]
},
{
"name": "sortOrder",
"in": "query",
"description": "Sort order.",
"required": false,
"type": "string",
"default": "Asc",
"enum": [ "Asc", "Desc" ]
},
{
"name": "subTasks",
"in": "query",
"description": "Adds subtasks to search scope",
"required": false,
"type": "boolean"
},
{
"name": "pageSize",
"in": "query",
"description": "Page size",
"required": false,
"type": "number",
"format": "float"
},
{
"name": "nextPageToken",
"in": "query",
"description": "Next page token, overrides any other parameters in request.",
"required": false,
"type": "string"
},
{
"name": "metadata",
"in": "query",
"description": "Metadata filter, exact match for metadata key or key-value pair",
"required": false,
"type": "string"
},
{
"name": "customField",
"in": "query",
"description": "Custom field filter (id/value). JSON object with 'id' and 'value' properties.",
"required": false,
"schema": {
"$ref": "#/definitions/CustomFields"
}
},
{
"name": "customStatuses",
"in": "query",
"description": "Custom statuses filter. JSON array with a list of Custom status IDs.",
"required": false,
"type": "string"
},
{
"name": "fields",
"in": "query",
"description": "[authorIds,hasAttachments,attachmentCount,parentIds,superParentIds,sharedIds,responsibleIds,description,briefDescription,recurrent,superTaskIds,subTaskIds,dependencyIds,customFields]",
"required": false,
"type": "array",
"items": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Definition generated from Swagger Inspector",
"schema": {
"$ref": "#/definitions/Task_Data"
}
}
},
"security": [
{
"Secured": []
}
]
},