Returns tasks for a specific incident.
curl -X GET https://my-dynamics-domain.api.crm.dynamics.com/api/data/v9.0/tasks \
-H "Accept: application/json" \
-H "OData-MaxVersion: 4.0" \
-H "OData-Version: 4.0" \
-d "$select=subject,description,actualstart,activityid,_regardingobjectid_value" \
-d "$filter=regardingobjectid_incident/incidentid eq c49e62a8-90df-e311-9565-a45d36fc5fe8" \
-H "Authorization: Bearer DYNAMICS_CRM_ACCESS_TOKEN"
#import <CkoRest.h>
#import <CkoStringBuilder.h>
#import <CkoJsonObject.h>
#import <NSString.h>
CkoRest *rest = [[CkoRest alloc] init];
BOOL success;
// URL: https://my-dynamics-domain.api.crm.dynamics.com/api/data/v9.0/tasks
BOOL bTls = YES;
int port = 443;
BOOL bAutoReconnect = YES;
success = [rest Connect: @"my-dynamics-domain.api.crm.dynamics.com" port: [NSNumber numberWithInt: port] tls: bTls autoReconnect: bAutoReconnect];
if (success != YES) {
NSLog(@"%@%d",@"ConnectFailReason: ",[rest.ConnectFailReason intValue]);
NSLog(@"%@",rest.LastErrorText);
return;
}
[rest AddQueryParam: @"$select" value: @"subject,description,actualstart,activityid,_regardingobjectid_value"];
[rest AddQueryParam: @"$filter" value: @"regardingobjectid_incident/incidentid eq c49e62a8-90df-e311-9565-a45d36fc5fe8"];
[rest AddHeader: @"OData-MaxVersion" value: @"4.0"];
[rest AddHeader: @"Accept" value: @"application/json"];
[rest AddHeader: @"OData-Version" value: @"4.0"];
[rest AddHeader: @"Authorization" value: @"Bearer DYNAMICS_CRM_ACCESS_TOKEN"];
CkoStringBuilder *sbResponseBody = [[CkoStringBuilder alloc] init];
success = [rest FullRequestNoBodySb: @"GET" uriPath: @"/api/data/v9.0/tasks" sb: sbResponseBody];
if (success != YES) {
NSLog(@"%@",rest.LastErrorText);
return;
}
int respStatusCode = [rest.ResponseStatusCode intValue];
if (respStatusCode >= 400) {
NSLog(@"%@%d",@"Response Status Code = ",respStatusCode);
NSLog(@"%@",@"Response Header:");
NSLog(@"%@",rest.ResponseHeader);
NSLog(@"%@",@"Response Body:");
NSLog(@"%@",[sbResponseBody GetAsString]);
return;
}
CkoJsonObject *jsonResponse = [[CkoJsonObject alloc] init];
[jsonResponse LoadSb: sbResponseBody];
int i;
int count_i;
NSString *odataContext = [jsonResponse StringOf: @"\"@odata.context\""];
i = 0;
count_i = [[jsonResponse SizeOfArray: @"value"] intValue];
while (i < count_i) {
jsonResponse.I = [NSNumber numberWithInt: i];
NSString *odataEtag = [jsonResponse StringOf: @"value[i].\"@odata.etag\""];
NSString *subject = [jsonResponse StringOf: @"value[i].subject"];
NSString *description = [jsonResponse StringOf: @"value[i].description"];
NSString *actualstart = [jsonResponse StringOf: @"value[i].actualstart"];
NSString *activityid = [jsonResponse StringOf: @"value[i].activityid"];
NSString *v_regardingobjectid_value = [jsonResponse StringOf: @"value[i]._regardingobjectid_value"];
i = i + 1;
}
{
"@odata.context": "https://mydomain.api.crm.dynamics.com/api/data/v9.0/$metadata#tasks(subject,description,actualstart,activityid,_regardingobjectid_value)",
"value": [
{
"@odata.etag": "W/\"1173836\"",
"subject": "Feedback on the product catalog",
"description": "Defined and captured critical customer requirements for the product catalog. Reviewed the draft content with key players on the committee; recorded attendees. Generated email using the relevant template.",
"actualstart": null,
"activityid": "ca81ac0c-91df-e311-b8e5-6c3be5a8b200",
"_regardingobjectid_value": "c49e62a8-90df-e311-9565-a45d36fc5fe8"
}
]
}