Skip to content

Create a role

POST
/v1/merchants/{merchant_id}/roles/

The permissions of the role are limited to your own. Without permissions, the role gets yours.

Authorization

apiKey
headerAuthorizationBasic <token>

HTTP Basic authentication with an API key or the id of a user token as the username and an empty password.

Path Parameters

merchant_id*string

The ID of the merchant, or self for the merchant of the credentials.

Request Body

application/json
  1. body
name*string
description?string
permissions?

Path permissions, see Permissions.

field_permissions?

Field permissions per resource and field, see Permissions. projects is the only resource.

Response Body

The new role.

application/json
  1. response
id?string
Formatuuid
created?string
Formatdate-time
modified?|
Formatdate-time
name*string
description?string
permissions?

Path permissions, see Permissions.

field_permissions?

Field permissions per resource and field, see Permissions. projects is the only resource.

curl -X POST 'https://api.example.com/v1/merchants/self/roles/' \  --user "$API_KEY:" \  -H 'Content-Type: application/json' \  -d '{  "name": "Order viewer",  "permissions": {    "/orders/**": {      "GET": true    },    "/search/orders/": {      "POST": true    }  }}'
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "created": "2019-08-24T14:15:22Z",  "modified": "2019-08-24T14:15:22Z",  "name": "string",  "description": "string",  "permissions": {    "property1": {      "GET": true,      "POST": true,      "PUT": true,      "DELETE": true,      "*": true    },    "property2": {      "GET": true,      "POST": true,      "PUT": true,      "DELETE": true,      "*": true    }  },  "field_permissions": {    "property1": {      "property1": {        "read": true,        "write": true      },      "property2": {        "read": true,        "write": true      }    },    "property2": {      "property1": {        "read": true,        "write": true      },      "property2": {        "read": true,        "write": true      }    }  }}