Jump to: navigation, search

Query Tasks

ApiRef2.png GET /services/${service_id}/tasks
Available since: 8.0.100.00

Description

This operation queries the tasks for a given service. By default, all the tasks are returned, but your application can filter the results to retrieve only active or completed tasks, based on the specified URI. Your application can also filter the returned tasks with additional URI parameters to select one or more task type and a given state.

Operation

ID CV.WS.SRV.13
Method GET
URL
  1. All (default): /services/${service_id}/tasks
  2. Active Tasks: /services/${service_id}/tasks/active
  3. Completed Tasks: /services/${service_id}/tasks/completed
Field Names   Type   Mandatory Description
URI Parameters
${service_id} string yes The service ID generated from the service creation.
state_id integer no Used to filter tasks by state ID. To filter both on the state id and the task_type, your application can also use this field identically to task_type.

For example: /services/${service_id}/tasks/completed?task_types=1,3&state_id=700

task_types long or string no Filters specific service task types separated by commas.
extensions string no Names, separated by commas, of the task extensions to return with the matching task resources. You can specify as many extension names as needed, as long as you previously created the corresponding schema with Create Task Extension Schema. By default, no extension is returned.

Response

The Context Management Service API answers with HTTP codes for every request. The following table shows the correct response for a successful request. See HTTP Response Codes and Errors for further details on the possible codes that this operation can return.

Response
HTTP code 200
HTTP message OK
Body Task[].

Example

Retrieve completed tasks

Operation Retrieve completed tasks for service 6001:

GET /services/15/tasks/completed?task_types=STT-DefineCustomerNeed%2CSTT-FillCustomerInfo&state_id=5&extensions=Survey

Result

[ {
 "service_id" : 1,
 "state_id" : 2,
 "task_id" : 0,
 "task_type" : 55,
 "est_duration" : 55,
 "started" : {
   "timestamp" : "2010-05-20T15:41:52.380Z",
   "interaction_id" : "65"
 },
 "Survey": 
  {"url":"http://ourServer/storage/userAnswers",
  "question1":7, "question2":true,
  "question3":"will be better with cable tv and on-demand video"
  },
 "Proposal": [
   {
    "car type":"cabriolet",
    "price":25 000,
    "seats":2,
    "comments":"200 cv, hardtop"
   },
   {
    "car type":"S.U.V.",
    "price":70 000,
    "seats":8,
    "comments":"4wd, leather seats"
   }
  ]
}, {
 "service_id" : 1,
 "state_id" : 1,
 "task_id" : 1,
 "task_type" : 12,
 "est_duration" : 900,
 "started" : {
   "timestamp" : "2010-05-20T15:42:57.207Z",
   "interaction_id" : "954"
 },
} ]

Retrieve active tasks

Operation Retrieve active tasks for service 6001:

 GET /services/6001/tasks/active

Result

[ {
  "service_id" : 6001,
  "task_id" : 15001,
  "task_type" : 1433,
  "started" : {
    "timestamp" : "2010-04-25T16:07:12.133Z",
    "application_type" : 1426,
    "media_type" : 1010,
    "resource_type" : 1423
  }
} ]

Operation Retrieve all tasks for service 6001:

  GET /services/6001/tasks

Result

[ {
  "service_id" : 6001,
  "duration" : 0,
  "task_id" : 15000,
  "task_type" : 1433,
  "started" : {
    "timestamp" : "2010-04-25T16:07:12.133Z",
    "application_type" : 1426,
    "media_type" : 1010,
    "resource_type" : 1423
  },
  "completed" : {
    "timestamp" : "2010-04-25T16:07:12.133Z",
    "application_type" : 1426,
    "media_type" : 1010,
    "resource_type" : 1423
  }
},{
  "service_id" : 6001,
  "task_id" : 15001,
  "task_type" : 1433,
  "started" : {
    "timestamp" : "2010-04-25T16:07:12.133Z",
    "application_type" : 1426,
    "media_type" : 1010,
    "resource_type" : 1423
  }
} ]
This page was last edited on November 23, 2017, at 13:14.
Comments or questions about this documentation? Contact us for support!