Jump to: navigation, search

Query Tasks

GET /services/${service_id}/tasks

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): /genesys/1/cs/services/${service_id}/tasks
  2. Active Tasks: /genesys/1/cs/services/${service_id}/tasks/active
  3. Completed Tasks: /genesys/1/cs/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: /genesys/1/cs/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 extension keys to return with the matching task resources. 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 /genesys/1/cs/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 /genesys/1/cs/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 /genesys/1/cs/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 September 7, 2018, at 10:34.
Comments or questions about this documentation? Contact us for support!