https://api.movidesk.com/public/v1
People
Note: The password created for this API must contain at least 8 digits.
URL: /persons Methods: GET / POST / PATCH / DELETE
Layout
person
Property | Type | Size | Required | Description |
---|---|---|---|---|
id | string | 64 | Field Code Ref. Unique identifier of the person. (Alphanumeric) | |
codeReferenceAdditional | string | 64 | Field Code Ref. Additional. Non-mandatory, but unique identifier of the person. (Alphanumeric) | |
isActive | bool | ✓ | Field Person enabled. | |
personType | int | 1 | ✓ | Person type. Person = 1, Company = 2, Department = 4. |
profileType | int | 1 | ✓ | Profile type. Agent = 1, Client = 2, Agent and Client = 3. |
accessProfile | string | 128 | * | Field Access profile. Must be an access profile already registered in Movidesk. If an invalid access profile is provided, the system will return an error. *Mandatory field when the person is an Agent profile. If the profile is Client and this field is not provided, the system will set the default client access profile. |
corporateName | string | 128 | * | Corporate name. *Mandatory field when the person is of type Company and the trade name has not been provided. |
businessName | string | 128 | ✓ | Trade name for companies or Name for individuals and departments. |
businessBranch | string | 128 | Field Business branch for a Company-type person. | |
cpfCnpj | string | 14 | CPF (11 digits) for individuals, CNPJ (14 digits) for companies, and non-existent for departments. | |
userName | string | 64 | * | Field Username. Must be unique per domain. Mandatory when a domain for authentication other than Movidesk is provided. |
password | string | 32 | Field Password. The password content is for writing only and cannot be retrieved in queries. | |
role | string | 128 | Person's role. If an unexisting role is provided, it will be created. | |
bossId | string | 64 | ||
bossId | string | 64 | Existing Id (Ref. Code) of the person's hierarchical superior. | |
bossName | string | 128 | Name of the hierarchical superior (read-only). | |
classification | string | 128 | Person's classification. If an unexisting classification is provided, it will be created. | |
cultureId | string | 32 | * | Person's language in the Microsoft CultureCode standard. Example for Brazilian Portuguese: pt-BR. *If not provided, the system admin's language will be used. |
timeZoneId | string | 64 | * | Person's time zone in the IANA standard. Example for Brasília's time zone: America/Sao_Paulo. *If not provided, the system admin's time zone will be used. |
authenticateOn | string | max | If directory authentication is enabled and the person authenticates in a domain other than Movidesk, the server and domain already registered in the system must be informed. Ex: hostdomeuservidorad\dominiodomeuservidorad | |
createdDate | datetime UTC | Person's creation date. It must be less than or equal to the current date. The provided date must be in UTC format*. If the field is not provided, it will be populated with the current date. Read-only after creation. | ||
createdBy | string | 128 | Ref. Code of the person who created the consulted person. Read-only field. | |
changedDate | datetime UTC | Last modification date of the person. Read-only field. | ||
changedBy | string | 128 | Ref. Code of the person who last modified the consulted person. Read-only field. | |
observations | string | max | Observations. | |
addresses | array | List of addresses. see documentation | ||
contacts | array | List of contacts. see documentation | ||
emails | array | List of emails. see documentation | ||
teams | array | * | Array of strings with the team names. *When the person's profile type is Agent, it is necessary to provide at least one team. | |
relationships | array | * | List of the person's relationships. There must be a single relationship per organization. *It may be mandatory (if set to be so) when the person's type is Person and the profile type is Client. see documentation | |
customFieldValues | array | List of the ticket's additional field values. see documentation | ||
atAssets | array | List of Asset values. |
People » Addresses
person.addresses[n]
Property | Type | Size | Required | Description |
---|---|---|---|---|
addressType | string | 128 | ✓ | Address type (Commercial, Residential, etc). If a non-existent type is provided, it will be created automatically. |
country | string | 128 | Country name. | |
postalCode | string | 32 | Postal code. | |
state | string | 128 | State. | |
city | string | 128 | City. | |
district | string | 128 | District. | |
street | string | 128 | Street name e.g., Joinville Street. | |
number | string | 32 | Number. | |
complement | string | 128 | Complement e.g., Room 201. | |
reference | string | 128 | Reference point e.g., Near the university. | |
isDefault | bool | ✓ | Indicator if this is the person's main address. Only one address can be the main address. |
People » Contacts
person.contacts[n]
Property | Type | Size | Required | Description |
---|---|---|---|---|
contactType | string | 128 | ✓ | Contact type e.g., (Phone, Mobile, Skype, etc). If an invalid type is provided, it will be created. |
contact | string | 128 | ✓ | Description e.g., (11) 9999-9999. |
isDefault | bool | ✓ | Indicator if this is the person's main contact. Only one contact can be the main contact. |
People » Emails
person.emails[n]
Property | Type | Size | Required | Description |
---|---|---|---|---|
emailType | string | 128 | ✓ | Email type e.g., (Personal, Professional, etc). If an invalid type is provided, it will be created. |
string | 128 | ✓ | Person's email, must be valid. | |
isDefault | bool | ✓ | Indicator if this is the person's main email. Only one email can be the main email. |
People » Organizations
person.relationships[n]
Property | Type | Size | Required | Description |
---|---|---|---|---|
id | string | 64 | Existing Id (Ref. Code) of the company or department to which the person belongs. To indicate hierarchy, the pattern IdParent/IdChild must be followed. To set up the SLA contract and allowed services without linking the person to any organization, do not provide this parameter. | |
name | string | 128 | Description of the hierarchy (Read-only). | |
slaAgreement | string | 128 | SLA contract used by the client. Must be an SLA contract already registered in Movidesk. If an invalid SLA contract is provided, the system will return an error. | |
forceChildrenToHaveSomeAgreement | bool | ✓ | If this value is set to true, all people linked to this hierarchy will be required to have the same SLA contract. | |
allowAllServices | bool | * | If this value is true, the person will have access to all items in the service catalog. Otherwise, the services the person will have access to must be specified. *If this value is not provided, it will be defaulted to true. | |
includeInParents | bool | If this value is true, this relationship will be included in the people of the parent organization, and to remove it, you will need to manually delete this relationship from the people in the parent organization. | ||
loadChildOrganizations | bool | If this value is true, relationships with the child organizations of the parent organization will be included, and to undo this, it will be necessary to manually remove these relationships. | ||
services | array | * | List of services the person will have access to. *It is mandatory to provide at least one service when the allowAllServices field is false. see documentation |
People » Organization » Services
person.relationships[n].services[n]
Property | Type | Size | Required | Description |
---|---|---|---|---|
id | int | 10 | ✓ | Id (Code) of the service. This can be obtained from the service query on the website. |
name | string | 128 | Name of the service (Read-only). | |
copyToChildren | bool | * | If this value is true, this service will be included for all people associated with this hierarchy. *If this value is not provided, it will default to true. |
People » Custom Fields
person.customfieldvalues[n]
Property | Type | Size | Required | Description |
---|---|---|---|---|
customFieldId | int | 64 | ✓ | Id of the custom field (can be obtained from the list of custom fields on the website). |
customFieldRuleId | int | 64 | ✓ | Id of the custom field display rule (can be obtained from the list of display rules on the website). |
line | int | 64 | ✓ | Number of the line in the display rule on the person's registration screen. When the rule does not allow the addition of new lines, enter the value 1, and do not repeat additional field values for the rule id in conjunction with the field id. To change the value of a field, specify the line where it is located. Fields that are in the database but not sent in the request body will be deleted. |
value | string | max | * | Text value of the custom field. *Required when the field type is: single line text, multi-line text, HTML text, regular expression, numeric, date, time, date and time, email, phone, or URL. Date fields must be in *UTC time and in the format YYYY-MM-DDThh:MM:ss.000Z, and the time field must be provided along with the fixed date "1991-01-01". The numeric field should be in Brazilian format, for example "1.530,75". |
items | array | * | List of items. *Required when the field type is: value list, people list, client list, agent list, multi-selection, or single-selection. Only one item should be provided if the custom field does not allow multiple selections. When the field is a file, it is read-only. see documentation |
People » Custom Fields » Items
person.customfieldvalues.items[n]
Property | Type | Size | Required | Description |
---|---|---|---|---|
personId | int | 64 | * | Id (Ref. Code) of the company, department, or person. *Required when the field type is people list. |
clientId | int | 64 | * | Id (Ref. Code) of the company, department, or person. *Required when the field type is client list. |
team | string | 128 | * | Team name. *Required when the field type is agent list (personId can be provided to specify the agent of the team). |
customFieldItem | string | 256 | * | Name of the custom field item. *Required when the field type is: value list, multi-selection, or single-selection. |
People » Assets
person.atAssets[n]
Property | Type | Size | Required | Description |
---|---|---|---|---|
Id | string | 64 | * | Field Ref. Code. Unique identifier of the asset. (Alphanumeric) |
name | string | 64 | Name of the asset | |
label | string | 64 |
Label field (Alphanumeric) |
*UTC: Coordinated Universal Time (from English Universal Time Coordinated) is the reference time zone from which all other time zones in the world are calculated. For example: If your time zone is Brasília (UTC-03:00) and the current time is 15:30, the UTC time will be 18:30.
Working with Data
To access the data, you first need to generate an API key
To generate an API key (token), access Movidesk, go to Settings / Account / Parameters and in the environment tab click the "Generate New Key" button if you do not already have one created.
You can repeat this operation whenever you want to generate a new access key, but remember that generating a new key will cause all programs using the old key to stop working.
All data flows (Viewing/Inserting/Updating) must be in JSON format as shown in the example below:
{ "id": "1", "codeReferenceAdditional": "33B", "isActive": true, "personType": 1, "profileType": 3, "accessProfile": "Administrators", "businessName": "Movidesk", "corporateName": "Movimentti systems", "cpfCnpj": "012345678900", "userName": "admin", "password": null, "role": null, "bossId": null, "classification": null, "cultureId": "en-US", "timeZoneId": "America/Sao_Paulo", "createdDate": "2014-12-17T18:00:43.3339728", "observations": "Registration done via person API.", "addresses": [ { "addressType": "Commercial", "country": "Brazil", "postalCode": "89035200", "state": "Santa Catarina", "district": "Vila Nova", "street": "Rua Joinville", "number": "209", "complement": "Room 201", "reference": "Next to FURB", "isDefault": true } ], "contacts": [ { "contactType": "Business phone", "contact": "(47) 3035-4150", "isDefault": true }, { "contactType": "Mobile phone", "contact": "(47) 9999-9999", "isDefault": false } ], "emails": [ { "emailType": "Professional", "email": "atendimento@movimentti.movidesk.com", "isDefault": true } ], "teams": [ "Administrators", "Consulting" ], "relationships": [ { "id": "2113", "name": "Movimentti", "slaAgreement": "Standard SLA contract", "forceChildrenToHaveSomeAgreement": false, "allowAllServices": false, "services": [ { "id": 5706, "name": "Support" } ] } ], "customFieldValues": [ { "customFieldId": 3, "customFieldRuleId": 2, "line": 1, "value": null, "items": [ { "personId": null, "clientId": null, "team": null, "customFieldItem": "one" } ] }, { "customFieldId": 1, "customFieldRuleId": 1, "line": 1, "value": "text via API", "items": [] } ] }Fetching data
Method GET
Fetching a single person
GET: /persons
Parameters: id, token
Example:
Fetching the person with id 1
GET: https://api.movidesk.com/public/v1/persons?token=52ee6ca5-8639-422b-bafe-470013c11176&id=1
Response:
{ "id": "1", "codeReferenceAdditional": "33B", "isActive": true, "personType": 1, "profileType": 3, "accessProfile": "Administrators", "businessName": "Movidesk", "corporateName": "Movimentti systems", "cpfCnpj": "012345678900", "userName": "admin", ... Other columns in the format of the above layout }
Fetching a list of people
GET: /persons
Parameters: token
Example:
Fetching a list of people
GET: https://api.movidesk.com/public/v1/persons?token=52ee6ca5-8639-422b-bafe-470013c11176
Response:
[ { "id": "1", "codeReferenceAdditional": "33B", "isActive": true, "personType": 2, "profileType": 3, "accessProfile": "Administrators", "businessName": "Movidesk", "corporateName": "Movimentti systems", "cpfCnpj": "012345678900", "userName": "admin", ... Other columns in the format of the above layout }, { "id": "2", "codeReferenceAdditional": "34B", "isActive": true, "personType": 1, "profileType": 1, "accessProfile": "Clients", "businessName": "Client A", "corporateName": "Client A", "cpfCnpj": "012345678901", "userName": "clientA", ... Other columns in the format of the above layout } ... Other items in the list ]
Fetching people with filters
GET: /persons
To enable and simplify queries with filters, the API uses the open protocol OData. The possible filters are:
Parameters: token
• $filter: the expression specified with this filter is evaluated for each item in the query result, and only the items where the expression result is true will be included in the final result;
• $orderby: allows the items in the query result to be ordered either ascending (asc) or descending (desc). If neither asc nor desc is specified, the default will be asc;
• $top: allows specifying the number of items that should be included in the query result;
• $skip: allows specifying the number of items that should be skipped and not included in the query result;
• $select: allows specifying specific properties of the items that should be filled in the query result;
• $expand: allows expanding the child collections of the queried items.
Note: $select clauses are always ignored when they are inside an $expand. That is, when an $expand exists, the API returns all available parameters in the array, and it is not possible to limit.
Examples:
Fetching a list of people who are of client profile type:
GET: https://api.movidesk.com/public/v1/persons?token=52ee6ca5-8639-422b-bafe-470013c11176&$filter=profileType eq 2
Response:
[ { "id": "1", "codeReferenceAdditional": "33B", "isActive": true, "personType": 2, "profileType": 2, "accessProfile": "Clients", "businessName": "Client A", "corporateName": "Client A", "cpfCnpj": "012345678900", "userName": "clientA", ... Other columns in the format of the above layout }, { "id": "2", "codeReferenceAdditional": "34B", "isActive": true, "personType": 1, "profileType": 2, "accessProfile": "Clients", "businessName": "Client B", "corporateName": "Client B", "cpfCnpj": "012345678901", "userName": "clientB", ... Other columns in the format of the above layout } ... Other items in the list with profileType equal to 2 ]
Fetching a list of people who are of client type and ordered in descending order by id:
GET: https://api.movidesk.com/public/v1/persons?token=52ee6ca5-8639-422b-bafe-470013c11176&$filter=profileType eq 2&$orderby=id desc
Response:
[ { "id": "2", "codeReferenceAdditional": "34B", "isActive": true, "personType": 1, "profileType": 2, "accessProfile": "Clients", "businessName": "Client B", "corporateName": "Client B", "cpfCnpj": "012345678901", "userName": "clientB", ... Other columns in the format of the above layout }, { "id": "1", "codeReferenceAdditional": "33B", "isActive": true, "personType": 2, "profileType": 2, "accessProfile": "Clients", "businessName": "Client A", "corporateName": "Client A", "cpfCnpj": "012345678900", "userName": "clientA", ... Other columns in the format of the above layout } ... Other items in the list sorted in descending order by id and with profileType equal to 2 ]
Fetching a list of people who are of client type, sorted in descending order by id and filtering the result to get only 100 people, while skipping the first 100 (used for pagination of the result, in this case to get the second page):
GET: https://api.movidesk.com/public/v1/persons?token=52ee6ca5-8639-422b-bafe-470013c11176&$filter=profileType eq 2&$orderby=id desc&$top=100&$skip=100
Response:
[ { "id": "102", "codeReferenceAdditional": "134B", "isActive": true, "personType": 1, "profileType": 2, "accessProfile": "Clients", "businessName": "Client B", "corporateName": "Client B", "cpfCnpj": "012345678901", "userName": "clientB", ... Other columns in the format of the above layout }, { "id": "101", "codeReferenceAdditional": "133B", "isActive": true, "personType": 2, "profileType": 2, "accessProfile": "Clients", "businessName": "Client A", "corporateName": "Client A", "cpfCnpj": "012345678900", "userName": "clientA", ... Other columns in the format of the above layout } ... Other 98 items in the list sorted in descending order by id and with profileType equal to 2 ]
Fetching the id and name of people who are of client type, sorted in descending order by id and filtering the result to get only 100 people, while skipping the first 100 (used for pagination of the result, in this case to get the second page):
GET: https://api.movidesk.com/public/v1/persons?token=52ee6ca5-8639-422b-bafe-470013c11176&$select=businessName,id&$filter=profileType eq 2&$orderby=id desc&$top=100&$skip=100
Response:
[ { "id": "102", "businessName": "Client B" }, { "id": "101", "businessName": "Client A" } ... Other 98 items in the list sorted in descending order by id and with profileType equal to 2 ]
Fetching the id, name, organizations, and allowed services of people who are of client type, sorted in descending order by id and filtering the result to get only 100 people, while skipping the first 100 (used for pagination of the result, in this case to get the second page):
GET: https://api.movidesk.com/public/v1/persons?token=52ee6ca5-8639-422b-bafe-470013c11176&$select=businessName,id&$expand=relationships($expand=services)&$filter=profileType eq 2&$orderby=id desc&$top=100&$skip=100
Response:
[ { "id": "102", "businessName": "Client B", "relationships": [ { "id": "2113", "name": "Movimentti", "slaAgreement": "Standard SLA Agreement", "forceChildrenToHaveSomeAgreement": false, "allowAllServices": false, "services": [ { "id": 5706, "name": "Support" } ] } ]}, { "id": "101", "businessName": "Client A", "relationships": [ { "slaAgreement": "Standard SLA Agreement", "forceChildrenToHaveSomeAgreement": false, "allowAllServices": true, "services": [] } ]} } ... Other 98 items in the list sorted in descending order by id and with profileType equal to 2 ]
Fetching people who have at least one email equal to "email@movidesk.com":
GET: https://api.movidesk.com/public/v1/persons?token=52ee6ca5-8639-422b-bafe-470013c11176&$filter=Emails/any(e: e/email eq 'email@movidesk.com')
Response:
[ { "id": "102", "businessName": "Client B", ... Other properties of the person "emails": [ { "emailType": "Commercial", "email": "email@movidesk.com", "isDefault": true }, { "emailType": "Personal", "email": "other.email@movidesk.com", "isDefault": false }], { "id": "101", "businessName": "Client A", ... Other properties of the person "emails": [ { "emailType": "Commercial", "email": "email@movidesk.com", "isDefault": true } ]} } ... Other items in the list that contain at least one email equal to "email@movidesk.com" ]
Inserting Data
Method POST
POST: /persons
Parameters: token, returnAllProperties (default value is false)
Headers: Content-Type: application/json
Request Body: {JSON object}
Example:
POST: https://api.movidesk.com/public/v1/persons?token=52ee6ca5-8639-422b-bafe-470013c11176&returnAllProperties=false Headers: Content-Type: application/json RequestBody: { "id": "1", "codeRefAdditional": "33B", "isActive": true, "personType": 2, "profileType": 3, "accessProfile": "Administrators", "businessName": "Movidesk", "corporateName": "Movimentti sistemas", "cpfCnpj": "012345678900", "userName": "admin", ... Other columns in the format of the layout above }
Response: Status 200 and in the body the id (reference code) of the inserted person.
Inserting Organizations for a Person
Method POST
POST: /persons/relationships
Parameters: token, id
Headers: Content-Type: application/json
Request Body: {JSON object}
Example:
Including the relationship of person with id 1 with organization of id 123
POST: https://api.movidesk.com/public/v1/persons/relationships?token=52ee6ca5-8639-422b-bafe-470013c11176&id=1 Headers: Content-Type: application/json RequestBody: { "relationships": [ { "id": "123", "allowAllServices": true } ] }
Response: Status 200
Updating Data
Method PATCH
Unlike data insertion (POST), updating is done partially. Thus, it is necessary to send only the data that you want to change to the server.
However, modifying lists (child objects) always overwrites all items in the list.
PATCH: /persons
Parameters: token, id
Headers: Content-Type: application/json
Body: {JSON object}
Examples:
Changing the name of the person with id 1
PATCH: https://api.movidesk.com/public/v1/persons?token=52ee6ca5-8639-422b-bafe-470013c11176&id=1 Headers: Content-Type: application/json RequestBody: { "businessName": "Movidesk" }
Response: Status 200
In the example above, only the businessName field is changed; other fields remain unchanged
Removing the emails of the person with id 1
PATCH: https://api.movidesk.com/public/v1/persons?token=52ee6ca5-8639-422b-bafe-470013c11176&id=1 Headers: Content-Type: application/json RequestBody: { "emails": [] }
Response: Status 200
As emails are in a list, in the example above, all emails are removed. This is because the values provided in the list always overwrite the previously stored values.
Deleting People
Method DELETE
DELETE: /persons
Parameters: token, id
Headers: Content-Type: application/json
Request Body: {JSON object}
Examples:
Deleting the person with id 1
DELETE: https://api.movidesk.com/public/v1/persons?token=52ee6ca5-8639-422b-bafe-470013c11176&id=1 Headers: Content-Type: application/json
Response: Status 200
Source Code Example in C# for the API Call
Method POST
try { var person = new { isActive = true }; var json = JsonConvert.SerializeObject(person); var response = await SendAsync("https://api.movidesk.com/public/v1/persons?token=YOURTOKEN", json, "POST", "application/json"); } catch (WebException ex) { var response = new StreamReader(ex.Response.GetResponseStream()).ReadToEnd(); } public static async Task<string> SendAsync(string uri, string content, string method, string contentType) { var req = WebRequest.Create(uri); req.ContentType = contentType; req.Method = method; using (var stream = await req.GetRequestStreamAsync()) using (var streamWriter = new StreamWriter(stream)) { await streamWriter.WriteAsync(content); } var httpResponse = (HttpWebResponse)await req.GetResponseAsync(); using (var stream = httpResponse.GetResponseStream()) { if (stream == null) return null; using (var streamReader = new StreamReader(stream)) { return await streamReader.ReadToEndAsync(); } } }
In the example above, the person will not be inserted because there are several errors in the request body. The errors are detailed in the response variable and should be corrected by following this documentation.