API – Import organizational structure
- To import an organizational structure, you need to send POST request to the following URI /api/v2/orgstructure/import
You can import the organizational structure in two ways:
Import with CSV file
- The request must be accompanied by a file in the CSV format like this:
department code; name of the department; parent department code
a3123910441;department 1;
a2567104662;department 1.2;a3123910441
a2701216083;department 1.2.1;a2567104662
a2206647782;department 1.2.2;a2567104662
a3123410541;department 2;
a1468104662;department 2.1;a3123410541
a1206747582;department 2.1.2;a1468104662
- The request must contain the headings Content-Type: multipart/form-data та X-Cbr-Authorization: Bearer API_TOKEN.
Request example:
curl 'https://your-domain.davintoo.com/api/v2/orgstructure/import' -H 'X-Cbr-Authorization: Bearer API_TOKEN' -H 'Content-Type: multipart/form-data' -F 'file=@/path/to/structure.csv'
Import of organizational structure in JSON format
Instead of a CSV file, you can add information about the organizational structure in JSON format to the body of the request, for example:
[ { "uid": "structureid1", "title": "structure1" }, { "uid": "departmentid2", "parent_uid": "structureid1", "title": "department2" }, { "uid": "departmentid3", "parent_uid": "structureid1", "title": "department3" } ]
- The request must contain the headers Content-Type: application/json and X-Cbr-Authorization: Bearer API_TOKEN
- Body settings: raw, JSON
Request example:
`curl 'https://your-domain.davintoo.com/api/v2/orgstructure/import' -H 'X-Cbr-Authorization: Bearer API_TOKEN' -H 'Content-Type: application/json'