Services API
16 min
Criado por Knowledge Engineering Team em 01/12/2020 18:49
Atualizado por Knowledge Engineering Team em 08/12/2020 05:51

On this page

Services API concepts and usage

Object properties

Retrieve a service

Retrieve a list of services

Create a service

Update a service

Delete a service

Filtered query examples

 

Services API concepts and usage

This API can be used to maintain the Service catalog by retrieving, creating, updating, and deleting services. You can use the API to perform the same functions that can be accomplished manually in Configurations > Services, with the exception of maintaining fixed participant lists for events related to a service.

If looking to import a large service catalog into Movidesk, tools such as Postman can be used to create, delete, and update settings in services in bulk via the API.

You can also use the API to sync service catalogs between Movidesk and another repository, either by retrieving a filtered list of services from Movidesk to update another service catalog, or by updating the Movidesk Service catalog through the API.

 

API Base URL

All API endpoint URLs in this article use the following base URL:

https://api.movidesk.com/public/v1

 

Object properties

This API can retrieve, create, update, and delete Service objects in the Service catalog.

Objects

Service

 

Service

An item on the Service catalog that can be selected on tickets by customers and agents. Used to drive workflows, reporting, and automation.

Services can be organized in multiple levels of parent/child relationships within the catalog through the parentServiceId property, which can ease navigation and still achieve the necessary specificity.

Clipboard

Note Services at the top of the hierarchical structure of the Service Catalog do not have a parent service.

 

JSON Path

service

Property

Type

Max length

Required?

Description

id

Int

 

 

Code of the service. Read-only

name

String

     128

Yes 

Service name

description

String

 

 

Service description

parentServiceId

Int

 

 

Unique identifier of the parent service within the service catalog

serviceForTicketType

Int

 1

Yes

Types of tickets that can use the service: Public tickets=0, Internal tickets=1, Public and internal tickets=2

isVisible

Int

 1

Yes

Profile types the service is visible to: Agents=1, Customers=2, Agents and customers=3

allowSelection

Int

 1

Yes

Profile types that can select the service: Agents=1, Customers=2, Agents and customers=3

allowFinishTicket

Boolean

 

Yes

Tickets cannot be closed with this service if set to false. An agent or a trigger must change the ticket’s service before closing the ticket

isActive

Boolean

 

Yes

The service will not be visible and cannot be selected if set to false. Services can be reenabled in Configurations > Ticket classification > Services or through this API

automationMacro

String

64

 

Name of a macro that will be automatically executed whenever the service is selected by a user

defaultCategory

String

128

 

Name of the default category that will be set on the ticket whenever the service is selected by a user

defaultUrgency

String

128

 

Name of the default priority that will be set on the ticket whenever the service is selected by a user

allowAllCategories

Boolean

 

Yes

Allows all ticket categories if true. Valid categories for the ticket must be listed in the categories property if set to false

categories

Array

128

Yes*

List of all categories that can be selected on tickets with this service

Only required when allowAllCategories is false

 

 

 

Retrieve a service

Retrieve all properties of a specific service.

GET: /services

 

Parameters

Location

Type

Required?

Description

token

Query string

String

Yes

Movidesk API token found in Configurations > Account > Parameters

id

Query string

Int

Yes

id of the service that will be retrieved

 

This example is a request to retrieve the service with id 504212, which returns all properties of that service.

Sample request

GET: https://api.movidesk.com/public/v1/services?token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&id=504212

Sample response

{
    "id": 504212,
    "name": "Product support",
    "description": null,
    "parentServiceId": null,
    "serviceForTicketType": 2,
    "isVisible": 3,
    "allowSelection": 3,
    "allowFinishTicket": false,
    "isActive": true,
    "automationMacro": null,
    "defaultCategory": "Problem",
    "defaultUrgency": "Medium",
    "allowAllCategories": true,
    "categories": []
}

 

Retrieve a list of services

Retrieves properties of the selected services. By default, all services will be returned.

Head with gears

Tip Use $select to specify which properties of the service should be returned, otherwise all properties will be included. You can also use other OData query parameters to sort, filter, and page the results.

 

GET: /services

 

Parameters

Location

Type

Required?

Description

token

Query string

String

Yes

Movidesk API token found in Configurations > Account > Parameters

 

This example is a request for the list of services from the Service catalog, which returns a full list of services and service properties. Go to Filtered query examples for sample requests and responses using OData query parameters.

Sample request

GET: https://api.movidesk.com/public/v1/services?token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

Sample response

[

   {
      "id": 504212,
      "name": "Product support",
      "description": null,
      "parentServiceId": null,
      "serviceForTicketType": 2,
      "isVisible": 3,
      "allowSelection": 3,
      "allowFinishTicket": false,
      "isActive": true,
      "automationMacro": null,
      "defaultCategory": "Problem",
      "defaultUrgency": "Medium",
      "allowAllCategories": true,
      "categories": []
   },
   {
      "id": 504288,
      "name": "Online portal",
      "description": null,
      "parentServiceId": 504212,
      "serviceForTicketType": 2,
      "isVisible": 3,
      "allowSelection": 3,
      "allowFinishTicket": true,
      "isActive": true,
      "automationMacro": null,
      "defaultCategory": "Problem",
      "defaultUrgency": "Medium",
      "allowAllCategories": true,
      "categories": []
   },
   {
      "id": 504287,
      "name": "3rd party integrations",
      "description": null,
      "parentServiceId": 504212,
      "serviceForTicketType": 2,
      "isVisible": 3,
      "allowSelection": 3,
      "allowFinishTicket": true,
      "isActive": true,
      "automationMacro": null,
      "defaultCategory": "Problem",
      "defaultUrgency": "Medium",
      "allowAllCategories": false,
      "categories": [
         "Problem",
         "Question"
      ]
   }
]

 

Create a service

Add a new service to the Service catalog.

POST: /services

 

Parameters

Location

Type

Required?

Description

Content-Type

Header

Content type

Yes

Should always be application/json

token

Query string

String

Yes

Movidesk API token found in Configurations > Account > Parameters

Service properties

Body

JSON

Yes

Properties of the new service

 

This example is a request to create a new child service for the “Product support” service, including a macro in automationMacro that was previously configured.

The API returns a Status 200 (OK) and the id of the new service.

Clipboard

Note The property id will be ignored if it is included in the JSON content of the request, but will not cause an error.

 

Sample request

POST: https://api.movidesk.com/public/v1/services?token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Headers: Content-Type: application/json

{
   "name": "Customization",
   "description": "Tickets with this service will be automatically assigned to the Customizations team",
   "parentServiceId": 504212,
   "serviceForTicketType": 2,
   "isVisible": 3,
   "allowSelection": 3,
   "allowFinishTicket": true,
   "isActive": true,
   "automationMacro": "Assign to customization team",
   "defaultCategory": "Service request",
   "defaultUrgency": "Medium",
   "allowAllCategories": false,
   "categories": [
      "Question",
      "Service request"
    ]
}

 

Sample response

{
    "id": 504298
}

 

Update a service

Make changes to a service in the Service catalog by sending JSON key/value pairs for the properties you want to change.

Warning

Warning Updating array properties such as categories will replace all values in the array with the values in your request.

 

PATCH: /services

 

Parameters

Location

Type

Required?

Description

Content-Type

Header

Content type

Yes

Should always be application/json

token

Query string

String

Yes

Movidesk API token found in Configurations > Account > Parameters

id

Query string

Int

Yes

id of the service that will be updated

Service properties

Body

JSON

Yes

Properties to be updated

 

This example is a request to update the service with id 504298, which was created in the previous example.

The request is removing the parentServiceId in order to move the service to the top level of the Service catalog, as it should no longer be a child service in the catalog. We are also adding "Service request" as an allowed category in categories.

The API returns a status, but no JSON data.

Clipboard

Note The property id will be ignored if it is included in the JSON content of the request, but will not cause an error.

 

Sample request

PATCH: https://api.movidesk.com/public/v1/services?token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&id=504298
Headers: Content-Type: application/json

{
   "parentServiceId": null,
   "categories": [
      "Problem",
      "Question",
      "Service request"
    ]
}

 

Delete a service

Delete a service in the Service catalog.

DELETE: /services

 

Parameters

Location

Type

Required?

Description

token

Query string

String

Yes

Movidesk API token found in Configurations > Account > Parameters

id

Query string

Int

Yes

id of the service that will be deleted

 

This example is a request to delete the service with id 504298.

The API returns a status, but no JSON data.

Sample request

DELETE: https://api.movidesk.com/public/v1/services?token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&id=504298

 

Filtered query examples

These examples use OData query parameters to customize the results of GET requests.

Retrieve specific properties on a single service

Retrieve all disabled services in descending order

Retrieve all disabled services in descending order with pagination

 

Retrieve specific properties on a single service

This example uses $select to specify which properties should be returned, which is combined in this example with with $filter.

It will return only the properties name, id, and categories, in that order, for the service that matches the $filter criteria of id = 504287.

Sample request

GET: https://api.movidesk.com/public/v1/services?token= XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&$filter=id eq 504287&$select=categories,id,name

Sample response

[
   {
      "name": "3rd party integrations",
      "id": 504287,
      "categories": [
         "Problem",
         "Question"
      ]
   }
]

 

Retrieve all disabled services in descending order

This example uses $filter and $orderby to retrieve only disabled services by filtering on isActive = false and then list them in descending order by id.

Since we did not use $select, all properties are returned

Sample request

GET: https://api.movidesk.com/public/v1/services?token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&$filter=isActive eq false&$orderby=id desc

Sample response

[
   {
      "id": 504203,
      "name": "Hardware maintenance",
      "description": null,
      "parentServiceId": 504201,
      "serviceForTicketType": 0,
      "isVisible": 0,
      "allowSelection": 0,
      "allowFinishTicket": false,
      "isActive": false,
      "automationMacro": null,
      "defaultCategory": null,
      "defaultUrgency": null,
      "allowAllCategories": true,
      "categories": []
   },
   {
      "id": 504201,
      "name": "Self hosted portal",
      "description": null,
      "parentServiceId": 504212,
      "serviceForTicketType": 0,
      "isVisible": 0,
      "allowSelection": 0,
      "allowFinishTicket": false,
      "isActive": false,
      "automationMacro": null,
      "defaultCategory": null,
      "defaultUrgency": null,
      "allowAllCategories": true,
      "categories": []
   }
]

 

Retrieve all disabled services in descending order with pagination

This example builds upon the previous example and demonstrates how you can incorporate pagination with the $top and $skip query parameters, which can be useful for larger service catalogs. This particular request retrieves the second page in a scenario where we’re looking for 10 services per page.

$top limits our results to 10 services, our maximum per page, while $skip ignores the first 10 results that would have been retrieved for the first page.

We are still using $filter and $orderby to retrieve only disabled services by filtering on isActive = false and then list them in descending order by id.

Since our catalog has less than 10 services across the different levels, the API returns an empty list.

Sample request

GET: https://api.movidesk.com/public/v1/services?token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&$filter=isActive eq false&$orderby=id desc&$top=10&$skip=10

Sample response

[]
Classifique este artigo
Últimos artigos visitados