Shyft Customer > Departments API

The Customer > Departments API from Shyft — 6 operation(s) for customer > departments.

OpenAPI Specification

shyft-customer-departments-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: Shyft Customer Authentication > Email Customer > Departments API
  description: "Welcome to the Shyft Customer App API.\n\nShyft customer App API is designed to support the function of Shyft Mobile App(iOS, Android), Web App and Manager Dashboard.\n\nNOTES:\n\n- In parameters section, the letter `R` stands for `Required`.\n    \n- All API examples show only essential data set.\n    \n\n## Authentication\n\n---\n\nInclude as headers for API calls after authentication token.\n\n| Name | Values | R | Description |\n| --- | --- | --- | --- |\n| Session-Uukey |  | \\* | The value got from authentication API call (SignIn/Confirm) |\n\n## Global Information\n\n---\n\n#### Query Parameters\n\n###### For All API:\n\n| Name | Values | R | Description |\n| --- | --- | --- | --- |\n| api_version | String |  | Ex. 6_0_0 |\n| response\\[nested\\] | Integer |  | Ex. 1 |\n| response\\[keep\\] | String |  | Ex. location\\[current_user_privilege\\],name,id |\n| response\\[only\\] | String |  | Ex. id,location\\[id,location_name,current_user_privilege\\] |\n| response\\[except\\] | String |  | Ex. name,location\\[id,location_name,swift_code\\],owner\\[id\\] |\n\n- The query parameter `response[only]` is needed to help API performance by limiting the size of returned data.\n    \n- On test server, `response[only]` support wildcard, you can supply `response[only]=\\*` to get everything.\n    \n- Production server does not support wildcard, you need to figure out and supply your `response[only]` for each API call.\n    \n\n###### For Index API:\n\n- Pagination Option 1)\n    \n\n| Name | Values | R | Description |\n| --- | --- | --- | --- |\n| page | Integer |  | Ex. 1 |\n| per_page | Integer |  | Ex. 5 |\n| total | boolean |  | true/false |\n| order | String |  | Ex. start_at_desc, start_at_asc |\n\n- Pagination Option 2)\n    \n\n| Name | Values | R | Description |\n| --- | --- | --- | --- |\n| limit | Integer |  | Ex. 10 |\n| offset | Integer |  | Ex. 5 |\n| order | String |  | Ex. start_at_desc, start_at_asc |\n| last_id | Integer |  | Ex. 101 |\n\n###### For Update API:\n\n| Name | Values | R | Description |\n| --- | --- | --- | --- |\n| response\\[put_return_resource\\] | String |  | Ex. true |\n\n#### Headers\n\n| Name | Values | R | Description |\n| --- | --- | --- | --- |\n| Platform | ios|android|web | \\* |  |\n| Api-Version | 6_0_0 | \\* | Ex: 6_0_0 |\n| Build-Number |  | \\* |  |\n| Push-Id |  |  |  |\n| X-Method |  |  | Deprecated |\n| Content-Type | application/json | \\* |  |\n\n#### Success Codes\n\n| SUCCESS Code | Meaning |\n| --- | --- |\n| 200 | Created -- Objet created. |\n| 201 | Unauthorized -- Your API key is wrong. |\n| 204 | No Content -- Success without returning resource. |\n\n#### Error Codes\n\n| Error Code | Meaning |\n| --- | --- |\n| 400 | Bad Request -- Your request is invalid. |\n| 401 | Unauthorized -- Your API key is wrong. |\n| 403 | Forbidden -- The records requested is hidden for administrators only. |\n| 404 | Not Found -- The specified record could not be found. |\n| 405 | Method Not Allowed -- You tried to access a record with an invalid method. |\n| 406 | Not Acceptable -- You requested a format that isn't json. |\n| 410 | Gone -- The record requested has been removed from our servers. |\n| 422 | Unprocessable Entity -- Invalid input data. |\n| 429 | Too Many Requests -- You're requesting too many requests! Slow down! |\n| 500 | Internal Server Error -- We had a problem with our server. Try again later. |\n| 502 | Bad Gateway -- |\n| 504 | Gateway Timeout -- |\n| 503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |\n\n#### Error Response Formats\n\n422\n\n``` json\n{\n    \"errors\": {\n        \"base\": [\n            \"a private session for same two users already exists: 3034\"\n        ]\n    }\n}\n\n ```\n\n422\n\n```\n{\n    \"errors\": {\n        \"google_map_id\": [\n            \"can't be blank\"\n        ],\n        \"time_zone\": [\n            \"can't be blank\"\n        ],\n        \"longitude\": [\n            \"can't be blank\"\n        ]\n    }\n}\n{\n    \"errors\": {\n        \"record_invalid\": [\n            \"Validation failed: User has already been taken\"\n        ]\n    }\n}\n\n ```\n\n404\n\n``` json\n{\n    \"errors\": {\n        \"not_found\": [\n            \"Couldn't find Post\"\n        ]\n    }\n}\n\n ```\n\n500\n\n``` json\n{\n    \"errors\": {\n        \"internal_server_error\": [\n            \"Invalid nil value\"\n        ]\n    }\n}\n\n ```"
  version: 1.0.0
servers:
- url: http://{{host}}
- url: http://{{local-host}}
- url: http://{{sp3-host}}
- url: http://test-service.myshyft.com
- url: http://localhost:4001
- url: http://localhost:3000
- url: http://{{local-host}}api
- url: https://test-unfurl.myshyft.com
tags:
- name: Customer > Departments
paths:
  /api/customer/user_role/locations/2806/inner_departments:
    get:
      tags:
      - Customer > Departments
      summary: get location inner departments
      parameters:
      - name: Session-Uukey
        in: header
        schema:
          type: string
        example: '{{session_uukey}}'
      - name: Content-Type
        in: header
        schema:
          type: string
        example: application/json
      responses:
        '200':
          description: OK
          headers:
            Server:
              schema:
                type: string
                example: nginx/1.19.3
            Date:
              schema:
                type: string
                example: Sun, 18 Sep 2022 03:23:00 GMT
            Content-Type:
              schema:
                type: string
                example: application/json; charset=utf-8
            Transfer-Encoding:
              schema:
                type: string
                example: chunked
            Connection:
              schema:
                type: string
                example: keep-alive
            X-Frame-Options:
              schema:
                type: string
                example: SAMEORIGIN
            X-XSS-Protection:
              schema:
                type: string
                example: 1; mode=block
            X-Content-Type-Options:
              schema:
                type: string
                example: nosniff
            X-Download-Options:
              schema:
                type: string
                example: noopen
            X-Permitted-Cross-Domain-Policies:
              schema:
                type: string
                example: none
            Referrer-Policy:
              schema:
                type: string
                example: strict-origin-when-cross-origin
            X-LS-License:
              schema:
                type: string
                example: All Rights Reserved © Coffee Enterprise
            X-LS-Application:
              schema:
                type: string
                example: Coffee Mobile
            X-Request-Method:
              schema:
                type: string
                example: none
            ETag:
              schema:
                type: string
                example: W/"1155cb1a6df8ee1e83400febb3f2e30f"
            Cache-Control:
              schema:
                type: string
                example: max-age=0, private, must-revalidate
            Set-Cookie:
              schema:
                type: string
                example: _shyft_api_server_session=allLMCtQSDQyVUpmUGtVUjNFUzZlTVBoZmtLOHhLTmhtNmFFUFFsZWM4dFl2dUlKVElCVkF3a0RPUjJ2NmNJMElLTzN5eWZ2bmhiQ3ZWMm5jOUpYMnc9PS0tSkp0aUU4c2t3ay9DK3BHY3N1OS80QT09--82153287fea5bc9f0e12d6e6b31b33bae83f08a7; path=/; HttpOnly
            X-Rack-Dev-Mark-Env:
              schema:
                type: string
                example: BinLocalServer
            X-Request-Id:
              schema:
                type: string
                example: fbc54ba3-4ffe-45ed-b040-0d31bd6949a9
            X-Runtime:
              schema:
                type: number
                example: '1.300053'
            Vary:
              schema:
                type: string
                example: Origin
          content:
            application/json:
              schema:
                type: object
              example:
                departments:
                - _parent_object_id: null
                  id: 1
                  location_id: 2806
                  name: Sample Department
                  description: null
  /api/customer/user_role/departments/mine:
    get:
      tags:
      - Customer > Departments
      summary: get mine departments
      parameters:
      - name: Session-Uukey
        in: header
        schema:
          type: string
        example: '{{session_uukey}}'
      - name: Content-Type
        in: header
        schema:
          type: string
        example: application/json
      responses:
        '200':
          description: OK
          headers:
            Server:
              schema:
                type: string
                example: nginx/1.19.3
            Date:
              schema:
                type: string
                example: Mon, 19 Sep 2022 06:13:13 GMT
            Content-Type:
              schema:
                type: string
                example: application/json; charset=utf-8
            Transfer-Encoding:
              schema:
                type: string
                example: chunked
            Connection:
              schema:
                type: string
                example: keep-alive
            X-Frame-Options:
              schema:
                type: string
                example: SAMEORIGIN
            X-XSS-Protection:
              schema:
                type: string
                example: 1; mode=block
            X-Content-Type-Options:
              schema:
                type: string
                example: nosniff
            X-Download-Options:
              schema:
                type: string
                example: noopen
            X-Permitted-Cross-Domain-Policies:
              schema:
                type: string
                example: none
            Referrer-Policy:
              schema:
                type: string
                example: strict-origin-when-cross-origin
            X-LS-License:
              schema:
                type: string
                example: All Rights Reserved © Coffee Enterprise
            X-LS-Application:
              schema:
                type: string
                example: Coffee Mobile
            X-Request-Method:
              schema:
                type: string
                example: none
            ETag:
              schema:
                type: string
                example: W/"5c46867ece13ab7e25b71012c0a55cc9"
            Cache-Control:
              schema:
                type: string
                example: max-age=0, private, must-revalidate
            Set-Cookie:
              schema:
                type: string
                example: _shyft_api_server_session=S1dFSFRZMnNKMkc4aER0Qjgzbm55NjNHcVZOd2h2eGZ6azFnVkc0ZUVDT2Zwb0pjcjVFUEc1TlV3TGU4c2NaMjkrbjAyY0RGWEh4ck1RWGtIYjVqM0E9PS0tS3JGT1NmSHkrZnZlZ0k5TlA4eHkrUT09--2cb857ae1ccb27b9803bae64697ea7b5b0cd33cd; path=/; HttpOnly
            X-Rack-Dev-Mark-Env:
              schema:
                type: string
                example: BinLocalServer
            X-Request-Id:
              schema:
                type: string
                example: 7277b3dd-e3de-43aa-a790-26261567e591
            X-Runtime:
              schema:
                type: number
                example: '0.425395'
            Vary:
              schema:
                type: string
                example: Origin
          content:
            application/json:
              schema:
                type: object
              example:
                departments:
                - _parent_object_id: null
                  id: 1
                  location_id: 2806
                  name: Sample Department 2
                  description: null
                  users_count: 5
                  user_ids:
                  - 14196
                  - 14199
                  - 14206
                  - 7613
                  - 14815
                meta:
                  pagination:
                    current_page: 1
                    per_page: 25
  /api/customer/user_role/departments:
    post:
      tags:
      - Customer > Departments
      summary: create a new department
      requestBody:
        content:
          '*/*':
            schema:
              type: string
              example: '"{\n\"department\": {\n    \"location_id\": 2806,\n    \"name\": \"Sample Department\",\n    \"description\": \"Test Sample Department\"\n    }\n}\t\t"'
      parameters:
      - name: Session-Uukey
        in: header
        schema:
          type: string
        example: '{{session_uukey}}'
      - name: Content-Type
        in: header
        schema:
          type: string
        example: application/json
      responses:
        '201':
          description: Created
          headers:
            Server:
              schema:
                type: string
                example: nginx/1.19.3
            Date:
              schema:
                type: string
                example: Sun, 18 Sep 2022 22:56:38 GMT
            Content-Type:
              schema:
                type: string
                example: application/json; charset=utf-8
            Transfer-Encoding:
              schema:
                type: string
                example: chunked
            Connection:
              schema:
                type: string
                example: keep-alive
            X-Frame-Options:
              schema:
                type: string
                example: SAMEORIGIN
            X-XSS-Protection:
              schema:
                type: string
                example: 1; mode=block
            X-Content-Type-Options:
              schema:
                type: string
                example: nosniff
            X-Download-Options:
              schema:
                type: string
                example: noopen
            X-Permitted-Cross-Domain-Policies:
              schema:
                type: string
                example: none
            Referrer-Policy:
              schema:
                type: string
                example: strict-origin-when-cross-origin
            X-LS-License:
              schema:
                type: string
                example: All Rights Reserved © Coffee Enterprise
            X-LS-Application:
              schema:
                type: string
                example: Coffee Mobile
            X-Request-Method:
              schema:
                type: string
                example: none
            ETag:
              schema:
                type: string
                example: W/"2431117b344f7e250ca30b7b0e36678a"
            Cache-Control:
              schema:
                type: string
                example: max-age=0, private, must-revalidate
            Set-Cookie:
              schema:
                type: string
                example: _shyft_api_server_session=NVcvQXN6ZWdRV0h5ckxqVGF5M0NPK21Bekl2ck9PdnRJYkhnaURCQ3FFV2wybDJaOUNzVU84bE9zYll0SGZrRU1uMVFZNEIyT2tkNDJ4OHZybW1Pb0E9PS0tWXZoM0FxUld6TzYvUmpmUjVNWlR2Zz09--30cc94175768c6d1e76558c5f819a45bc812641d; path=/; HttpOnly
            X-Rack-Dev-Mark-Env:
              schema:
                type: string
                example: BinLocalServer
            X-Request-Id:
              schema:
                type: string
                example: f9e1591b-aa50-4f0c-9bc8-097595cdfa82
            X-Runtime:
              schema:
                type: number
                example: '0.408060'
            Vary:
              schema:
                type: string
                example: Origin
          content:
            application/json:
              schema:
                type: object
              example:
                department:
                  _parent_object_id: null
                  id: 2
                  location_id: 2806
                  name: Sample Department
                  description: Test Sample Department
                  users_count: 0
  /api/customer/user_role/departments/1:
    put:
      tags:
      - Customer > Departments
      summary: update a new department
      requestBody:
        content:
          '*/*':
            schema:
              type: string
              example: '"{\n\"department\": {\n    \"name\": \"Sample Department 2\"\n    }\n}\t\t"'
      parameters:
      - name: Session-Uukey
        in: header
        schema:
          type: string
        example: '{{session_uukey}}'
      - name: Content-Type
        in: header
        schema:
          type: string
        example: application/json
      responses:
        '204':
          description: No Content
          headers:
            Server:
              schema:
                type: string
                example: nginx/1.19.3
            Date:
              schema:
                type: string
                example: Sun, 18 Sep 2022 23:00:02 GMT
            Connection:
              schema:
                type: string
                example: keep-alive
            X-Frame-Options:
              schema:
                type: string
                example: SAMEORIGIN
            X-XSS-Protection:
              schema:
                type: string
                example: 1; mode=block
            X-Content-Type-Options:
              schema:
                type: string
                example: nosniff
            X-Download-Options:
              schema:
                type: string
                example: noopen
            X-Permitted-Cross-Domain-Policies:
              schema:
                type: string
                example: none
            Referrer-Policy:
              schema:
                type: string
                example: strict-origin-when-cross-origin
            X-LS-License:
              schema:
                type: string
                example: All Rights Reserved © Coffee Enterprise
            X-LS-Application:
              schema:
                type: string
                example: Coffee Mobile
            X-Request-Method:
              schema:
                type: string
                example: none
            Cache-Control:
              schema:
                type: string
                example: no-cache
            Set-Cookie:
              schema:
                type: string
                example: _shyft_api_server_session=OHJtMlN0U3N5cGRzYStSTmtXZjZTVkU2WGNhWWxRbEdldFlybGo0bkExVUFYbEUrd0FFVWFIek50cnpBK0tDTVQ1OVAraGdLRGdTNGJBMmlJNzh4UUE9PS0tMExaQ2VZd3N2Vm9KUFM3YVo0NHBydz09--07e7dd47e69f99b4fb2076a29f591f55600d6778; path=/; HttpOnly
            X-Rack-Dev-Mark-Env:
              schema:
                type: string
                example: BinLocalServer
            X-Request-Id:
              schema:
                type: string
                example: 1dd2554f-3735-41f7-9cac-1dfbcb93af52
            X-Runtime:
              schema:
                type: number
                example: '0.235478'
            Vary:
              schema:
                type: string
                example: Origin
          content:
            text/plain:
              schema:
                type: string
              example: null
  /api/customer/user_role/departments/1/assign_users:
    put:
      tags:
      - Customer > Departments
      summary: assign a department users
      requestBody:
        content:
          '*/*':
            schema:
              type: string
              example: '"{\n    \"department\": {\n        \"remove_user_ids\": [ 14794, 14992, 14474, 14974]\n    }\n}\t"'
      parameters:
      - name: Session-Uukey
        in: header
        schema:
          type: string
        example: '{{session_uukey}}'
      - name: Content-Type
        in: header
        schema:
          type: string
        example: application/json
      - name: response[put_return_resource]
        in: query
        schema:
          type: boolean
        example: 'true'
      responses:
        '200':
          description: OK
          headers:
            Server:
              schema:
                type: string
                example: nginx/1.19.3
            Date:
              schema:
                type: string
                example: Mon, 19 Sep 2022 04:58:37 GMT
            Content-Type:
              schema:
                type: string
                example: application/json; charset=utf-8
            Transfer-Encoding:
              schema:
                type: string
                example: chunked
            Connection:
              schema:
                type: string
                example: keep-alive
            X-Frame-Options:
              schema:
                type: string
                example: SAMEORIGIN
            X-XSS-Protection:
              schema:
                type: string
                example: 1; mode=block
            X-Content-Type-Options:
              schema:
                type: string
                example: nosniff
            X-Download-Options:
              schema:
                type: string
                example: noopen
            X-Permitted-Cross-Domain-Policies:
              schema:
                type: string
                example: none
            Referrer-Policy:
              schema:
                type: string
                example: strict-origin-when-cross-origin
            X-LS-License:
              schema:
                type: string
                example: All Rights Reserved © Coffee Enterprise
            X-LS-Application:
              schema:
                type: string
                example: Coffee Mobile
            X-Request-Method:
              schema:
                type: string
                example: none
            ETag:
              schema:
                type: string
                example: W/"ef0a0816122ded71c6a6db9a2e42c1a2"
            Cache-Control:
              schema:
                type: string
                example: max-age=0, private, must-revalidate
            Set-Cookie:
              schema:
                type: string
                example: _shyft_api_server_session=ejlyWWdLU3BYa05JelRFVmhqWFdSbU1aWGx3cktZdEFTMUMrSDJUM1NtaGtUYll5cC8wWnYvdi81K1Vya3F3YTVTdmhUTHdkNzdzd0JEY0JtVVh6Vmc9PS0tY0tLNFp1eFhjZ2JaMGhKdDFCdkp6dz09--00c4c9d0893f2b78a3e8d946a3f953a69861f995; path=/; HttpOnly
            X-Rack-Dev-Mark-Env:
              schema:
                type: string
                example: BinLocalServer
            X-Request-Id:
              schema:
                type: string
                example: 45659acd-0efc-46d9-b139-03959889f113
            X-Runtime:
              schema:
                type: number
                example: '0.417984'
            Vary:
              schema:
                type: string
                example: Origin
          content:
            application/json:
              schema:
                type: object
              examples:
                example-0:
                  summary: assign a department users - add
                  value:
                    department:
                      _parent_object_id: null
                      id: 1
                      location_id: 2806
                      name: Sample Department 2
                      description: null
                      users_count: 8
                example-1:
                  summary: assign a department users - remove
                  value:
                    department:
                      _parent_object_id: null
                      id: 1
                      location_id: 2806
                      name: Sample Department 2
                      description: null
                      users_count: 4
  /api/customer/user_role/departments/2:
    delete:
      tags:
      - Customer > Departments
      summary: delete a department
      parameters:
      - name: Session-Uukey
        in: header
        schema:
          type: string
        example: '{{session_uukey}}'
      - name: Content-Type
        in: header
        schema:
          type: string
        example: application/json
      responses:
        '204':
          description: No Content
          headers:
            Server:
              schema:
                type: string
                example: nginx/1.19.3
            Date:
              schema:
                type: string
                example: Sun, 18 Sep 2022 23:05:23 GMT
            Connection:
              schema:
                type: string
                example: keep-alive
            X-Frame-Options:
              schema:
                type: string
                example: SAMEORIGIN
            X-XSS-Protection:
              schema:
                type: string
                example: 1; mode=block
            X-Content-Type-Options:
              schema:
                type: string
                example: nosniff
            X-Download-Options:
              schema:
                type: string
                example: noopen
            X-Permitted-Cross-Domain-Policies:
              schema:
                type: string
                example: none
            Referrer-Policy:
              schema:
                type: string
                example: strict-origin-when-cross-origin
            X-LS-License:
              schema:
                type: string
                example: All Rights Reserved © Coffee Enterprise
            X-LS-Application:
              schema:
                type: string
                example: Coffee Mobile
            X-Request-Method:
              schema:
                type: string
                example: none
            Cache-Control:
              schema:
                type: string
                example: no-cache
            Set-Cookie:
              schema:
                type: string
                example: _shyft_api_server_session=TEFERlFTcHhsdjJ6TlhRZ2xhVzFOSVBkZlgzdFROMU13Qkw1V0VXN1BRcXUxSXY0WFpRRGZOM2ptWkFXVjJXZFdvZUJldGtYTE14WWVEUlJLc2ZCZlE9PS0tNDhzWEFBYmlQZmdGNXhsSHhWYWI2Zz09--8cea5ae86d841368b618c11c57fe7cb77191f8c8; path=/; HttpOnly
            X-Rack-Dev-Mark-Env:
              schema:
                type: string
                example: BinLocalServer
            X-Request-Id:
              schema:
                type: string
                example: 692f08f0-de64-4923-8bec-b893830928fc
            X-Runtime:
              schema:
                type: number
                example: '1.050138'
            Vary:
              schema:
                type: string
                example: Origin
          content:
            text/plain:
              schema:
                type: string
              example: null
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
    noauthAuth:
      type: http
      scheme: noauth