The calls for managing a organization via the Skyresponse Admin API
depends on the permissions set for the logged in administrator, i.e. on your access token.
For example, if the access token has the default credentials for a seller
you will be allowed to create both organizations
and suborganizations
, however, if the access token has the default credentials for a organization
you will only be allowed to create suborganizations
.
In this section we will cover both adding a new organization and adding a suborganization.
seller
The following HTTP signature provides the minimal subset of fields required to be in the JSON body
:
POST /api/customers HTTP/1.1
Host: https://admin.skyresponse.com
Content-Type: application/json
Authorization: Bearer tkgY9yiM...plBp
{
"Name": "Demo root organization",
"CustomerNumber": "+380111111"
}
If you provide the correct values, you should recieve an HTTP 202 Accepted
response from the server.
{
"data": {
"organizationId": 760
},
"errors": null
}
If there were any errors, e.g. incorrect required fields, fields missing, or this organization already exists, the server will respond HTTP 406 Not Acceptable
.
{
"data": null,
"errors": [
{
"name": "InvalidFieldValueHintParams",
"parameters": {
"FieldName": "CustomerNumber",
"FieldValue": null,
"ValidationHint": "ValidationHint_TelephoneNumber"
}
}
]
}
seller
or customer
To add a child organization
, you need to set the parent identifier ParentOrganizationId
. The parent identifier can be set to any organization your currently logged in admin has access to. To retrieve a list of all currently accessable organizations a call to Get /api/organizations/tree. To get information about your logged in admins current organization details call Get /api/organizations/details. A child organization can be created for any organization your administrator has rights to edit.
POST /api/organizations HTTP/1.1
Host: https://admin.skyresponse.com
Content-Type: application/json
Authorization: Bearer tkgY9yiM...plBp
{
"ParentOrganizationId": 760,
"Name": "Demo child organization A"
}
If you provide the correct values, you should recieve an HTTP 202 Accepted
response from the server.
{
"data": {
"organizationId": 761,
},
"errors": null
}
cURL
example:Example of add new organization:
curl -X POST -H "Content-Type: application/json" 'https://admin.skyresponse.com/api/organizations' -H "Authorization: Bearer PASTE_YOUR_TOKEN_HERE" -d '{"Name": "Demo root organization", "CustomerNumber": "+38011111111"}'
Example of add new suborganization:
curl -X POST 'https://admin.skyresponse.com/api/organizations' -H "Authorization: Bearer PASTE_YOUR_TOKEN_HERE" -d '{"Name": "Demo child organization A", "ParentOrganizationId": "760"}'
The calls for managing a organization via the Skyresponse Admin API
depends on the permissions set for the logged in administrator, i.e. on your access token.
For example, if the access token has the default credentials for a seller
you will be allowed to create both organizations
and suborganizations
, however, if the access token has the default credentials for a organization
you will only be allowed to create suborganizations
.
In this section we will cover both adding a new organization and adding a suborganization.
seller
The following HTTP signature provides the minimal subset of fields required to be in the JSON body
:
POST /api/customers HTTP/1.1
Host: https://admin.skyresponse.com
Content-Type: application/json
Authorization: Bearer tkgY9yiM...plBp
{
"Name": "Demo root organization",
"CustomerNumber": "+380111111"
}
If you provide the correct values, you should recieve an HTTP 202 Accepted
response from the server.
{
"data": {
"organizationId": 760
},
"errors": null
}
If there were any errors, e.g. incorrect required fields, fields missing, or this organization already exists, the server will respond HTTP 406 Not Acceptable
.
{
"data": null,
"errors": [
{
"name": "InvalidFieldValueHintParams",
"parameters": {
"FieldName": "CustomerNumber",
"FieldValue": null,
"ValidationHint": "ValidationHint_TelephoneNumber"
}
}
]
}
seller
or customer
To add a child organization
, you need to set the parent identifier ParentOrganizationId
. The parent identifier can be set to any organization your currently logged in admin has access to. To retrieve a list of all currently accessable organizations a call to Get /api/organizations/tree. To get information about your logged in admins current organization details call Get /api/organizations/details. A child organization can be created for any organization your administrator has rights to edit.
POST /api/organizations HTTP/1.1
Host: https://admin.skyresponse.com
Content-Type: application/json
Authorization: Bearer tkgY9yiM...plBp
{
"ParentOrganizationId": 760,
"Name": "Demo child organization A"
}
If you provide the correct values, you should recieve an HTTP 202 Accepted
response from the server.
{
"data": {
"organizationId": 761,
},
"errors": null
}
cURL
example:Example of add new organization:
curl -X POST -H "Content-Type: application/json" 'https://admin.skyresponse.com/api/organizations' -H "Authorization: Bearer PASTE_YOUR_TOKEN_HERE" -d '{"Name": "Demo root organization", "CustomerNumber": "+38011111111"}'
Example of add new suborganization:
curl -X POST 'https://admin.skyresponse.com/api/organizations' -H "Authorization: Bearer PASTE_YOUR_TOKEN_HERE" -d '{"Name": "Demo child organization A", "ParentOrganizationId": "760"}'