Add customer

Note

The calls for managing a customer 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 customers and subcustomers, however, if the access token has the default credentials for a customer you will only be allowed to create subcustomers.

In this section we will cover both adding a customer and adding a subcustomer.

Add a new customer to Skyresponse Admin with default credentials as a 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 Customer One",
  "CustomerNumber": "+380111111"
}

If you provide the correct values, you should recieve an HTTP 202 Accepted response from the server.

{
  "data": {
    "customerId": 760
  },
  "errors": null
}

If there were any errors, e.g. incorrect required fields, fields missing, or this customer already exists, the server will respond HTTP 406 Not Acceptable.

{
  "data": null,
  "errors": [
    {
      "name": "InvalidFieldValueHintParams",
      "parameters": {
        "FieldName": "CustomerNumber",
        "FieldValue": null,
        "ValidationHint": "ValidationHint_TelephoneNumber"
      }
    }
  ]
}

Add a new subcustomer to Skyresponse Admin with default credentials as a seller or customer

To add a subcustomer, you need to know the corresponding customerId. You can check for it as described in add user tutorial in step 1.

You can also provide the name query parameter. Note, that if it is not defined, subcustomer will have an auto-generated name.

POST /api/customers/{customerId}/subcustomers?name={name} HTTP/1.1
Host: https://admin.skyresponse.com
Content-Type: application/json
Authorization: Bearer tkgY9yiM...plBp

If you provide the correct values, you should recieve an HTTP 202 Accepted response from the server.

{
  "data": {
    "Id": 761,
    "Name": "Demo"
  },
  "errors": null
}

cURL example:

Example of add new customer:

curl -X POST -H "Content-Type: application/json" 'https://admin.skyresponse.com/api/customers' -H "Authorization: Bearer PASTE_YOUR_TOKEN_HERE" -d '{"Name": "Demo Customer", "CustomerNumber": "+38011111111"}'

Example of add new subcustomer:

curl -X POST 'https://admin.skyresponse.com/api/customers/132/subcustomers?name=Demo' -H "Authorization: Bearer PASTE_YOUR_TOKEN_HERE"

Full documentation:
Topics:

Add customer

Note

The calls for managing a customer 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 customers and subcustomers, however, if the access token has the default credentials for a customer you will only be allowed to create subcustomers.

In this section we will cover both adding a customer and adding a subcustomer.

Add a new customer to Skyresponse Admin with default credentials as a 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 Customer One",
  "CustomerNumber": "+380111111"
}

If you provide the correct values, you should recieve an HTTP 202 Accepted response from the server.

{
  "data": {
    "customerId": 760
  },
  "errors": null
}

If there were any errors, e.g. incorrect required fields, fields missing, or this customer already exists, the server will respond HTTP 406 Not Acceptable.

{
  "data": null,
  "errors": [
    {
      "name": "InvalidFieldValueHintParams",
      "parameters": {
        "FieldName": "CustomerNumber",
        "FieldValue": null,
        "ValidationHint": "ValidationHint_TelephoneNumber"
      }
    }
  ]
}

Add a new subcustomer to Skyresponse Admin with default credentials as a seller or customer

To add a subcustomer, you need to know the corresponding customerId. You can check for it as described in add user tutorial in step 1.

You can also provide the name query parameter. Note, that if it is not defined, subcustomer will have an auto-generated name.

POST /api/customers/{customerId}/subcustomers?name={name} HTTP/1.1
Host: https://admin.skyresponse.com
Content-Type: application/json
Authorization: Bearer tkgY9yiM...plBp

If you provide the correct values, you should recieve an HTTP 202 Accepted response from the server.

{
  "data": {
    "Id": 761,
    "Name": "Demo"
  },
  "errors": null
}

cURL example:

Example of add new customer:

curl -X POST -H "Content-Type: application/json" 'https://admin.skyresponse.com/api/customers' -H "Authorization: Bearer PASTE_YOUR_TOKEN_HERE" -d '{"Name": "Demo Customer", "CustomerNumber": "+38011111111"}'

Example of add new subcustomer:

curl -X POST 'https://admin.skyresponse.com/api/customers/132/subcustomers?name=Demo' -H "Authorization: Bearer PASTE_YOUR_TOKEN_HERE"

Full documentation: