CompanyCam Groups API

The Groups API from CompanyCam — 2 operation(s) for groups.

OpenAPI Specification

companycam-groups-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  version: v2
  title: Core Checklists Groups API
servers:
- url: https://api.companycam.com/v2
security:
- BearerAuth: []
tags:
- name: Groups
paths:
  /groups:
    get:
      summary: List Groups
      operationId: listGroups
      tags:
      - Groups
      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 groups sorted alphabetically
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Group'
        '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 Group
      operationId: createGroup
      tags:
      - Groups
      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:
                group:
                  type: object
                  properties:
                    name:
                      type: string
                    users:
                      type: array
                      items:
                        type: string
      responses:
        '201':
          description: The created group
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Group'
        '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
  /groups/{id}:
    get:
      summary: Retrieve Group
      operationId: getGroup
      tags:
      - Groups
      parameters:
      - name: id
        in: path
        description: ID of the Group
        required: true
        schema:
          type: string
          format: id
      responses:
        '200':
          description: Details about the group
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Group'
        '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 Group
      parameters:
      - name: id
        in: path
        description: ID of the Group
        required: true
        schema:
          type: string
          format: id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                group:
                  type: object
                  properties:
                    name:
                      type: string
                    users:
                      type: array
                      items:
                        type: string
      operationId: updateGroup
      tags:
      - Groups
      responses:
        '201':
          description: The updated group
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Group'
        '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 a Group
      parameters:
      - name: id
        in: path
        description: ID of the Group
        required: true
        schema:
          type: string
          format: id
      operationId: deleteGroup
      tags:
      - Groups
      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:
    Group:
      type: object
      required:
      - id
      properties:
        id:
          type: string
          description: A unique ID for the Group.
          example: '3992883'
        company_id:
          type: string
          description: A unique ID for the Company the Group belongs to
          example: '8292212'
        name:
          type: string
          description: The title of the Group
          example: The Psych Crew
        users:
          type: array
          description: A list of the group's users
          items:
            $ref: '#/components/schemas/User'
        status:
          type: string
          description: Indicates the status of the Group
          enum:
          - active
          - deleted
          example: active
        group_url:
          type: string
          description: The link to the group in the web app
          example: https://app.companycam.com/groups/1234
        created_at:
          type: integer
          format: int32
          description: Timestamp when the Group was created on the server
          example: 1490737206
        updated_at:
          type: integer
          format: int32
          description: Timestamp when the Group was last updated
          example: 1490737744
    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