CompanyCam Users API

The Users API from CompanyCam — 3 operation(s) for users.

OpenAPI Specification

companycam-users-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  version: v2
  title: Core Checklists Users API
servers:
- url: https://api.companycam.com/v2
security:
- BearerAuth: []
tags:
- name: Users
paths:
  /users/current:
    get:
      summary: Retrieve Current User
      operationId: getCurrentUser
      tags:
      - Users
      responses:
        '200':
          description: Details about the current user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - Bad Request
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - Record not found
        '500':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - An unexpected error occured
  /users:
    get:
      summary: List All Users
      operationId: listUsers
      tags:
      - Users
      parameters:
      - name: page
        in: query
        schema:
          type: integer
          format: int32
      - name: per_page
        in: query
        schema:
          type: integer
          format: int32
      responses:
        '200':
          description: List of users sorted by alphabetically
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/User'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - Bad Request
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - Record not found
        '500':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - An unexpected error occured
    post:
      summary: Create User
      operationId: createUser
      tags:
      - Users
      parameters:
      - name: X-CompanyCam-User
        in: header
        description: Email of CompanyCam user to be designated as the creator
        required: false
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                user:
                  type: object
                  properties:
                    first_name:
                      type: string
                    last_name:
                      type: string
                    email_address:
                      type: string
                    phone_number:
                      type: string
                    password:
                      type: string
                    user_role:
                      type: string
                      description: 'Role for the user. Allowed values: standard (default), restricted'
      responses:
        '201':
          description: The created user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - Bad Request
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - Record not found
        '500':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - An unexpected error occured
  /users/{id}:
    get:
      summary: Retrieve User
      operationId: getUser
      tags:
      - Users
      parameters:
      - name: id
        in: path
        description: ID of the User
        required: true
        schema:
          type: string
          format: id
      responses:
        '200':
          description: Details about the user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - Bad Request
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - Record not found
        '500':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - An unexpected error occured
    put:
      summary: Update User
      parameters:
      - name: X-CompanyCam-User
        in: header
        description: Email of CompanyCam user to be designated as the editor
        required: false
        schema:
          type: string
      - name: id
        in: path
        description: ID of the User
        required: true
        schema:
          type: string
          format: id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                first_name:
                  type: string
                last_name:
                  type: string
                email_address:
                  type: string
                phone_number:
                  type: string
                password:
                  type: string
      operationId: updateUser
      tags:
      - Users
      responses:
        '200':
          description: The updated user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - Bad Request
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - Record not found
        '500':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - An unexpected error occured
    delete:
      summary: Delete User
      parameters:
      - name: X-CompanyCam-User
        in: header
        description: Email of CompanyCam user to be designated as the editor
        required: false
        schema:
          type: string
      - name: id
        in: path
        description: ID of the User
        required: true
        schema:
          type: string
          format: id
      operationId: deleteUser
      tags:
      - Users
      responses:
        '204':
          description: No Content
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - Bad Request
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - Record not found
        '500':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - An unexpected error occured
components:
  schemas:
    User:
      type: object
      required:
      - id
      properties:
        id:
          type: string
          example: '2789583992'
        company_id:
          type: string
          example: '8292212'
        email_address:
          type: string
          example: shawn@psych.co
        status:
          type: string
          description: Indicates the status of the Company.
          enum:
          - active
          - deleted
          example: active
        first_name:
          type: string
          example: Shawn
        last_name:
          type: string
          example: Spencer
        profile_image:
          type: array
          description: A list of images for the different variants of the user profile image
          items:
            $ref: '#/components/schemas/ImageURI'
        phone_number:
          type: string
          nullable: true
          example: '4025551212'
        created_at:
          type: integer
          format: int32
          example: 1490737206
        updated_at:
          type: integer
          format: int32
          example: 1490737206
        user_url:
          type: string
          example: https://app.companycam.com/users/1234
    Error:
      type: object
      properties:
        errors:
          type: array
          items:
            type: string
          example:
          - Record not found
    ImageURI:
      type: object
      required:
      - type
      - uri
      properties:
        type:
          type: string
        uri:
          type: string
        url:
          type: string
      example:
        type: original
        uri: https://static.companycam.com/VuS0rPvrnNA1490797262.jpg
        url: https://static.companycam.com/VuS0rPvrnNA1490797262.jpg
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer