Commerce Layer roles API

resource type

Documentation

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

commerce-layer-roles-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Commerce Layer addresses roles API
  version: 7.10.1
  contact:
    name: API Support
    url: https://commercelayer.io
    email: support@commercelayer.io
  description: Headless Commerce for Global Brands.
servers:
- url: https://{your_organization_slug}.commercelayer.io/api
  description: API
- url: https://core.commercelayer.io/users/sign_in
  description: Sign in
- url: https://docs.commercelayer.io/api
  description: API reference
security:
- bearerAuth: []
tags:
- name: roles
  description: resource type
paths:
  /api_credentials/{apiCredentialId}/role:
    get:
      operationId: GET/apiCredentialId/role
      summary: Related API credential
      description: Related API credential
      tags:
      - roles
      parameters:
      - name: apiCredentialId
        in: path
        schema:
          type: string
        required: true
        description: The ID of the resource.
      responses:
        '200':
          description: The role associated to the API credential
  /application_memberships/{applicationMembershipId}/role:
    get:
      operationId: GET/applicationMembershipId/role
      summary: Related application membership
      description: Related application membership
      tags:
      - roles
      parameters:
      - name: applicationMembershipId
        in: path
        schema:
          type: string
        required: true
        description: The ID of the resource.
      responses:
        '200':
          description: The role associated to the application membership
  /memberships/{membershipId}/role:
    get:
      operationId: GET/membershipId/role
      summary: Related membership
      description: Related membership
      tags:
      - roles
      parameters:
      - name: membershipId
        in: path
        schema:
          type: string
        required: true
        description: The ID of the resource.
      responses:
        '200':
          description: The role associated to the membership
  /organizations/{organizationId}/roles:
    get:
      operationId: GET/organizationId/roles
      summary: Related organization
      description: Related organization
      tags:
      - roles
      parameters:
      - name: organizationId
        in: path
        schema:
          type: string
        required: true
        description: The ID of the resource.
      responses:
        '200':
          description: The roles associated to the organization
  /permissions/{permissionId}/role:
    get:
      operationId: GET/permissionId/role
      summary: Related permission
      description: Related permission
      tags:
      - roles
      parameters:
      - name: permissionId
        in: path
        schema:
          type: string
        required: true
        description: The ID of the resource.
      responses:
        '200':
          description: The role associated to the permission
  /roles:
    post:
      operationId: POST/roles
      summary: Creates an role
      description: Creates an role
      tags:
      - roles
      requestBody:
        required: true
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/roleCreate'
      responses:
        '201':
          description: The created role object
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/roleResponse'
    get:
      operationId: GET/roles
      summary: List all roles
      description: List all roles
      tags:
      - roles
      responses:
        '200':
          description: A list of role objects
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/roleResponseList'
  /roles/{roleId}:
    get:
      operationId: GET/roles/roleId
      summary: Retrieve an role
      description: Retrieve an role
      parameters:
      - name: roleId
        in: path
        schema:
          type: string
        required: true
        description: The ID of the resource.
      tags:
      - roles
      responses:
        '200':
          description: The role object
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/roleResponse'
    patch:
      operationId: PATCH/roles/roleId
      summary: Updates an role
      description: Updates an role
      tags:
      - roles
      parameters:
      - name: roleId
        in: path
        schema:
          type: string
        required: true
        description: The ID of the resource.
      requestBody:
        required: true
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/roleUpdate'
      responses:
        '200':
          description: The updated role object
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/roleResponse'
components:
  schemas:
    roleUpdate:
      required:
      - data
      type: object
      properties:
        data:
          type: object
          required:
          - type
          - id
          - attributes
          properties:
            type:
              type: string
              description: The resource's type.
              enum:
              - roles
            id:
              type: string
              description: The ID of the resource.
              example: XGZwpOSrWL
            attributes:
              type: object
              properties:
                name:
                  type: string
                  description: The role name.
                  example: Custom role
                  nullable: false
                _add_missing_base_permissions:
                  type: boolean
                  description: Send this attribute if you want to update the role base permissions.
                  example: true
                  nullable: false
                reference:
                  type: string
                  description: A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.
                  example: ANY-EXTERNAL-REFEFERNCE
                  nullable: true
                reference_origin:
                  type: string
                  description: Any identifier of the third party system that defines the reference code.
                  example: ANY-EXTERNAL-REFEFERNCE-ORIGIN
                  nullable: true
                metadata:
                  type: object
                  description: Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.
                  example:
                    foo: bar
                  nullable: true
            relationships:
              type: object
              properties: {}
    roleResponseList:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/roleResponse/properties/data'
    roleResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            id:
              type: string
              description: The ID of the resource.
              example: XGZwpOSrWL
            type:
              type: string
              description: The resource's type.
              enum:
              - roles
            links:
              type: object
              properties:
                self:
                  type: string
                  description: URL
            attributes:
              $ref: '#/components/schemas/role/properties/data/properties/attributes'
            relationships:
              type: object
              properties:
                organization:
                  type: object
                  properties:
                    links:
                      type: object
                      properties:
                        self:
                          type: string
                          description: URL
                        related:
                          type: string
                          description: URL
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type.
                          enum:
                          - organization
                        id:
                          type: string
                          description: The ID of the resource.
                permissions:
                  type: object
                  properties:
                    links:
                      type: object
                      properties:
                        self:
                          type: string
                          description: URL
                        related:
                          type: string
                          description: URL
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type.
                          enum:
                          - permissions
                        id:
                          type: string
                          description: The ID of the resource.
                memberships:
                  type: object
                  properties:
                    links:
                      type: object
                      properties:
                        self:
                          type: string
                          description: URL
                        related:
                          type: string
                          description: URL
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type.
                          enum:
                          - memberships
                        id:
                          type: string
                          description: The ID of the resource.
                api_credentials:
                  type: object
                  properties:
                    links:
                      type: object
                      properties:
                        self:
                          type: string
                          description: URL
                        related:
                          type: string
                          description: URL
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type.
                          enum:
                          - api_credentials
                        id:
                          type: string
                          description: The ID of the resource.
                versions:
                  type: object
                  properties:
                    links:
                      type: object
                      properties:
                        self:
                          type: string
                          description: URL
                        related:
                          type: string
                          description: URL
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type.
                          enum:
                          - versions
                        id:
                          type: string
                          description: The ID of the resource.
    roleCreate:
      required:
      - data
      type: object
      properties:
        data:
          type: object
          required:
          - type
          - attributes
          properties:
            type:
              type: string
              description: The resource's type.
              enum:
              - roles
            attributes:
              type: object
              properties:
                name:
                  type: string
                  description: The role name.
                  example: Custom role
                reference:
                  type: string
                  description: A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.
                  example: ANY-EXTERNAL-REFEFERNCE
                reference_origin:
                  type: string
                  description: Any identifier of the third party system that defines the reference code.
                  example: ANY-EXTERNAL-REFEFERNCE-ORIGIN
                metadata:
                  type: object
                  description: Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.
                  example:
                    foo: bar
              required:
              - name
            relationships:
              type: object
              properties:
                organization:
                  required:
                  - data
                  type: object
                  properties:
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type.
                          enum:
                          - organizations
                        id:
                          type: string
                          description: The ID of the resource.
                          example: XGZwpOSrWL
              required:
              - organization
    role:
      properties:
        data:
          properties:
            attributes:
              type: object
              properties:
                name:
                  type: string
                  description: The role name.
                  example: Custom role
                  nullable: false
                kind:
                  type: string
                  description: 'The kind of role, one of: `custom`, `admin`, `read_only`'
                  example: custom
                  readOnly: true
                created_at:
                  type: string
                  description: Time at which the resource was created.
                  example: '2018-01-01T12:00:00.000Z'
                  readOnly: true
                updated_at:
                  type: string
                  description: Time at which the resource was last updated.
                  example: '2018-01-01T12:00:00.000Z'
                  readOnly: true
                reference:
                  type: string
                  description: A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.
                  example: ANY-EXTERNAL-REFEFERNCE
                  nullable: true
                reference_origin:
                  type: string
                  description: Any identifier of the third party system that defines the reference code.
                  example: ANY-EXTERNAL-REFEFERNCE-ORIGIN
                  nullable: true
                metadata:
                  type: object
                  description: Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.
                  example:
                    foo: bar
                  nullable: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT