Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
34 kB
2
Indexable
---
openapi: 3.0.1
info:
  title: "[WPP] DevHub API"
  version: 0.0.1
servers:
- url: http://localhost:8081/devhub/api
  description: Generated server url
security:
- Bearer Authentication: []
paths:
  "/accounts/{accountId}/roles/users":
    post:
      tags:
      - Account Roles
      summary: Get assigned users to the role
      operationId: getAssignedUsers
      parameters:
      - name: accountId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: Current-Tenant-Id
        in: header
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                type: string
                format: uuid
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  "$ref": "#/components/schemas/UserDto"
        '400':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "type": "about:blank",
                  "title": "WPP Invalid Request Exception",
                  "status": 400,
                  "detail": "Failed to update product with ID 'cb58666e-046e-45a4-8962-1b6c1295c506'. Update of deleted products is not allowed.",
                  "instance": "/devhub/api/products/cb58666e-046e-45a4-8962-1b6c1295c506",
                  "code": "DEVHUB_PRODUCT:CANNOT_UPDATE_DELETED"
                }
        '401':
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "type": "about:blank",
                  "title": "WPP Access Exception",
                  "status": 403,
                  "detail": "Access Denied",
                  "instance": "/devhub/api/products/cb58666e-046e-45a4-8962-1b6c1295c506",
                  "code": "ACCESS_FORBIDDEN:FORBIDDEN"
                }
        '404':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "type": "about:blank",
                  "title": "WPP Not Found Exception",
                  "status": 404,
                  "detail": "There is not 'NativeAppVersionEntity' which matches the predicate",
                  "instance": "/devhub/api/products/cb58666e-046e-45a4-8962-1b6c1295c506/native-app-versions/ab58666e-046e-45a4-8962-1b6c1295c502/permissions",
                  "code": "RECORD:NOT_FOUND_BY_PREDICATE"
                }
        '409':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "type": "about:blank",
                  "title": "WPP Duplicate Entity Exception",
                  "status": 409,
                  "detail": "Object of type '%s' already exists",
                  "instance": "/devhub/api/products/cb58666e-046e-45a4-8962-1b6c1295c506",
                  "code": "RECORD:ALREADY_EXISTS"
                }
        '412':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "type": "about:blank",
                  "title": "WPP Not Found Exception",
                  "status": 412,
                  "detail": "Cannot update product on verification: %s",
                  "instance": "/devhub/api/products/cb58666e-046e-45a4-8962-1b6c1295c506/native-app-versions/ab58666e-046e-45a4-8962-1b6c1295c502/permissions",
                  "code": "RECORD:CANNOT_UPDATE_ON_VERIFICATION_PRODUCT"
                }
        '422':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "type": "about:blank",
                  "title": "WPP Unprocessable Entity Exception",
                  "status": 422,
                  "detail": "'%s' operation failed for native application version due to unique field(s) duplication: [%s]",
                  "instance": "/devhub/api/products/cb58666e-046e-45a4-8962-1b6c1295c506/native-app-versions/ab58666e-046e-45a4-8962-1b6c1295c502",
                  "code": "DEVHUB_NATIVE_APP_VERSION:UNIQUE_FIELDS_DUPLICATION"
                }
        '500':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "timestamp": "2023-04-20T04:10:51.991+00:00",
                  "status": 500,
                  "error": "Internal Server Error",
                  "trace": "org.springframework.orm.jpa.JpaSystemException: ids for this class must be manually assigned before calling save(): com.wpp.openplatform.devhub.devhubapi.persistence.entity.user.UserEntity",
                  "path": "/devhub/api/products/6B29FC40-CA47-1067-B31D-00DD010662DA/native-app-versions/6B29FC40-CA47-1067-B31D-00DD010662DA"
                }
        '502':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "type": "about:blank",
                  "title": "WPP Integration Exception",
                  "status": 502,
                  "detail": "Workspace service has thrown an exception: %s",
                  "instance": "/devhub/api/products/cb58666e-046e-45a4-8962-1b6c1295c506/native-app-versions/ab58666e-046e-45a4-8962-1b6c1295c502/permissions",
                  "code": "DH_INTEGRATION:WORKSPACE_HTTP_CLIENT_ERROR"
                }
  "/accounts/{accountId}/roles":
    get:
      tags:
      - Account Roles
      summary: Get all roles
      operationId: getAllRoles
      parameters:
      - name: accountId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: Current-Tenant-Id
        in: header
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  "$ref": "#/components/schemas/AlphaZuluRoleDto"
        '400':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "type": "about:blank",
                  "title": "WPP Invalid Request Exception",
                  "status": 400,
                  "detail": "Failed to update product with ID 'cb58666e-046e-45a4-8962-1b6c1295c506'. Update of deleted products is not allowed.",
                  "instance": "/devhub/api/products/cb58666e-046e-45a4-8962-1b6c1295c506",
                  "code": "DEVHUB_PRODUCT:CANNOT_UPDATE_DELETED"
                }
        '401':
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "type": "about:blank",
                  "title": "WPP Access Exception",
                  "status": 403,
                  "detail": "Access Denied",
                  "instance": "/devhub/api/products/cb58666e-046e-45a4-8962-1b6c1295c506",
                  "code": "ACCESS_FORBIDDEN:FORBIDDEN"
                }
        '404':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "type": "about:blank",
                  "title": "WPP Not Found Exception",
                  "status": 404,
                  "detail": "There is not 'NativeAppVersionEntity' which matches the predicate",
                  "instance": "/devhub/api/products/cb58666e-046e-45a4-8962-1b6c1295c506/native-app-versions/ab58666e-046e-45a4-8962-1b6c1295c502/permissions",
                  "code": "RECORD:NOT_FOUND_BY_PREDICATE"
                }
        '409':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "type": "about:blank",
                  "title": "WPP Duplicate Entity Exception",
                  "status": 409,
                  "detail": "Object of type '%s' already exists",
                  "instance": "/devhub/api/products/cb58666e-046e-45a4-8962-1b6c1295c506",
                  "code": "RECORD:ALREADY_EXISTS"
                }
        '412':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "type": "about:blank",
                  "title": "WPP Not Found Exception",
                  "status": 412,
                  "detail": "Cannot update product on verification: %s",
                  "instance": "/devhub/api/products/cb58666e-046e-45a4-8962-1b6c1295c506/native-app-versions/ab58666e-046e-45a4-8962-1b6c1295c502/permissions",
                  "code": "RECORD:CANNOT_UPDATE_ON_VERIFICATION_PRODUCT"
                }
        '422':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "type": "about:blank",
                  "title": "WPP Unprocessable Entity Exception",
                  "status": 422,
                  "detail": "'%s' operation failed for native application version due to unique field(s) duplication: [%s]",
                  "instance": "/devhub/api/products/cb58666e-046e-45a4-8962-1b6c1295c506/native-app-versions/ab58666e-046e-45a4-8962-1b6c1295c502",
                  "code": "DEVHUB_NATIVE_APP_VERSION:UNIQUE_FIELDS_DUPLICATION"
                }
        '500':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "timestamp": "2023-04-20T04:10:51.991+00:00",
                  "status": 500,
                  "error": "Internal Server Error",
                  "trace": "org.springframework.orm.jpa.JpaSystemException: ids for this class must be manually assigned before calling save(): com.wpp.openplatform.devhub.devhubapi.persistence.entity.user.UserEntity",
                  "path": "/devhub/api/products/6B29FC40-CA47-1067-B31D-00DD010662DA/native-app-versions/6B29FC40-CA47-1067-B31D-00DD010662DA"
                }
        '502':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "type": "about:blank",
                  "title": "WPP Integration Exception",
                  "status": 502,
                  "detail": "Workspace service has thrown an exception: %s",
                  "instance": "/devhub/api/products/cb58666e-046e-45a4-8962-1b6c1295c506/native-app-versions/ab58666e-046e-45a4-8962-1b6c1295c502/permissions",
                  "code": "DH_INTEGRATION:WORKSPACE_HTTP_CLIENT_ERROR"
                }
    patch:
      tags:
      - Account Roles
      summary: Batch add role to account
      description: |
        Batch add users to role.
        Adds given users to given role in 'set' mode:
        if an empty list is received - all users will be unassigned.
      operationId: batchAddRolesToAccount
      parameters:
      - name: Current-Tenant-Id
        in: header
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/BatchRolesToAccountDto"
        required: true
      responses:
        '204':
          description: No Content
        '400':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "type": "about:blank",
                  "title": "WPP Invalid Request Exception",
                  "status": 400,
                  "detail": "Failed to update product with ID 'cb58666e-046e-45a4-8962-1b6c1295c506'. Update of deleted products is not allowed.",
                  "instance": "/devhub/api/products/cb58666e-046e-45a4-8962-1b6c1295c506",
                  "code": "DEVHUB_PRODUCT:CANNOT_UPDATE_DELETED"
                }
        '401':
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "type": "about:blank",
                  "title": "WPP Access Exception",
                  "status": 403,
                  "detail": "Access Denied",
                  "instance": "/devhub/api/products/cb58666e-046e-45a4-8962-1b6c1295c506",
                  "code": "ACCESS_FORBIDDEN:FORBIDDEN"
                }
        '404':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "type": "about:blank",
                  "title": "WPP Not Found Exception",
                  "status": 404,
                  "detail": "There is not 'NativeAppVersionEntity' which matches the predicate",
                  "instance": "/devhub/api/products/cb58666e-046e-45a4-8962-1b6c1295c506/native-app-versions/ab58666e-046e-45a4-8962-1b6c1295c502/permissions",
                  "code": "RECORD:NOT_FOUND_BY_PREDICATE"
                }
        '409':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "type": "about:blank",
                  "title": "WPP Duplicate Entity Exception",
                  "status": 409,
                  "detail": "Object of type '%s' already exists",
                  "instance": "/devhub/api/products/cb58666e-046e-45a4-8962-1b6c1295c506",
                  "code": "RECORD:ALREADY_EXISTS"
                }
        '412':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "type": "about:blank",
                  "title": "WPP Not Found Exception",
                  "status": 412,
                  "detail": "Cannot update product on verification: %s",
                  "instance": "/devhub/api/products/cb58666e-046e-45a4-8962-1b6c1295c506/native-app-versions/ab58666e-046e-45a4-8962-1b6c1295c502/permissions",
                  "code": "RECORD:CANNOT_UPDATE_ON_VERIFICATION_PRODUCT"
                }
        '422':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "type": "about:blank",
                  "title": "WPP Unprocessable Entity Exception",
                  "status": 422,
                  "detail": "'%s' operation failed for native application version due to unique field(s) duplication: [%s]",
                  "instance": "/devhub/api/products/cb58666e-046e-45a4-8962-1b6c1295c506/native-app-versions/ab58666e-046e-45a4-8962-1b6c1295c502",
                  "code": "DEVHUB_NATIVE_APP_VERSION:UNIQUE_FIELDS_DUPLICATION"
                }
        '500':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "timestamp": "2023-04-20T04:10:51.991+00:00",
                  "status": 500,
                  "error": "Internal Server Error",
                  "trace": "org.springframework.orm.jpa.JpaSystemException: ids for this class must be manually assigned before calling save(): com.wpp.openplatform.devhub.devhubapi.persistence.entity.user.UserEntity",
                  "path": "/devhub/api/products/6B29FC40-CA47-1067-B31D-00DD010662DA/native-app-versions/6B29FC40-CA47-1067-B31D-00DD010662DA"
                }
        '502':
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  type:
                    type: string
                  title:
                    type: string
                  details:
                    type: string
                  instance:
                    type: string
                  code:
                    type: string
              example: |
                {
                  "type": "about:blank",
                  "title": "WPP Integration Exception",
                  "status": 502,
                  "detail": "Workspace service has thrown an exception: %s",
                  "instance": "/devhub/api/products/cb58666e-046e-45a4-8962-1b6c1295c506/native-app-versions/ab58666e-046e-45a4-8962-1b6c1295c502/permissions",
                  "code": "DH_INTEGRATION:WORKSPACE_HTTP_CLIENT_ERROR"
                }
components:
  schemas:
    AttachmentMetaDto:
      type: object
      properties:
        key:
          type: string
          description: File key that was generated by GCP
          example: fbcb6a35-6fab-4947-83c1-9be0cda95699-image.jpg
        name:
          type: string
          description: File name
          example: image.jpg
        size:
          type: integer
          description: File size
          format: int64
          example: 1024
        description:
          maxLength: 500
          minLength: 1
          type: string
          description: File description
          example: File description
        ordering:
          type: integer
          description: Attachment order
          format: int32
          example: 0
    UserDto:
      type: object
      properties:
        id:
          type: string
          format: uuid
        email:
          type: string
        avatarOriginal:
          "$ref": "#/components/schemas/AttachmentMetaDto"
        avatarThumbnail:
          "$ref": "#/components/schemas/AttachmentMetaDto"
        firstname:
          type: string
        lastname:
          type: string
    BatchRolesToAccountDto:
      type: object
      properties:
        accountId:
          type: string
          description: Account ID
          format: uuid
          example: 449e7a5c-69d3-4b8a-aaaf-5c9b713ebc65
        roleId:
          type: string
          description: Role ID
          format: uuid
          example: ac4e70c8-d5be-48af-93eb-760f58fc91a9
        userIds:
          type: array
          description: Ids of users be assigned to role
          example: "[a169451c-8525-4352-b8ca-070dd449a1a5, 1c7cfc53-14ad-4910-96ce-5c6c66e29ec9]"
          items:
            type: string
            description: Ids of users be assigned to role
            format: uuid
    AlphaZuluPermissionDto:
      type: object
      properties:
        id:
          type: string
          description: Permission ID
          format: uuid
          example: 3fa85f64-5717-4562-b3fc-2c963f66afa6
        code:
          type: string
          description: |
            Permission code, used both - as permission's unique name and as technical code
            for permission checks in application
          example: WPP_PRODUCT_READ
        description:
          type: string
          description: Permission's description
          example: Grants rights to read products
        accountId:
          type: string
          description: Alpha Zulu account Id to create permission in
          format: uuid
          example: 1567ba61-97bd-4848-87f3-7ff7d65fb7f2
        isHidden:
          type: boolean
          description: If 'True' then user need special permission to see this permission
          example: false
        grantsOnParents:
          type: boolean
          description: 'If ''True'' then this permission will be applied not only
            to sub accounts but to ancestor accounts also

            '
          example: false
        roleAssignmentRestricted:
          type: boolean
          description: If 'True' then user need extra permission in order to assign
            this permission to role
          example: false
        accountRelationTypes:
          type: array
          description: Alpha Zulu relation types through which permission is applying
            (inheriting) downward
          example: "[OWNER, INHERITANCE]"
          items:
            type: string
            description: Alpha Zulu relation types through which permission is applying
              (inheriting) downward
            example: "[OWNER, INHERITANCE]"
            enum:
            - OWNER
            - MANAGER
            - ACCESS
            - APP_ACCESS
            - INHERITANCE
        roles:
          type: array
          description: Alpha Zulu roles that the permission is contained in
          items:
            "$ref": "#/components/schemas/AlphaZuluRoleDto"
      description: Alpha Zulu permissions that the role contains
    AlphaZuluRoleDto:
      type: object
      properties:
        id:
          type: string
          description: Role ID
          format: uuid
          example: 77d6f98d-158e-45f8-bc31-7c3dee80eb3b
        code:
          type: string
          description: |
            Role's code for technical use, unique for app version.
            Format: uppercase letters, digits and underscores only
          example: PRODUCT_READ_PERMISSION
        name:
          type: string
          description: |-
            User-friendly role name, unique for product version.
            Format: letters, digits and spaces only
          example: Regular User Role
        description:
          type: string
          description: Role's description
          example: Role for regular users
        inheritable:
          type: boolean
          description: |
            Controls if the role automatically applies not only to the assigned account
            but to all child accounts in its whole sub-tree as well
          example: false
        availableOnlyInAccountId:
          type: string
          description: |
            ID of role's Alpha Zulu account.
            Role could be assigned only to this account if 'inheritable' = false
          format: uuid
          example: 443e9021-107d-46bd-adaa-57abecfb94db
        availableOnlyInAccountName:
          type: string
          description: |
            Name of role's Alpha Zulu account.
            Role could be assigned only to this account if 'inheritable' = false
          example: Agency A
        createdAt:
          type: string
          description: Role's creation date-time
          format: date-time
        updatedAt:
          type: string
          description: Role's update date-time
          format: date-time
        permissions:
          type: array
          description: Alpha Zulu permissions that the role contains
          items:
            "$ref": "#/components/schemas/AlphaZuluPermissionDto"
        osRoles:
          type: array
          description: Mapped OS meta role codes.
          example:
          - VIEWER
          - CONTRIBUTOR
          items:
            type: string
            description: Mapped OS meta role codes.
            example: '["VIEWER","CONTRIBUTOR"]'
            enum:
            - VIEWER
            - CONTRIBUTOR
            - OWNER
    ProblemDetail:
      type: object
      properties:
        status:
          type: integer
          format: int32
        type:
          type: string
        title:
          type: string
        details:
          type: string
        instance:
          type: string
        code:
          type: string
  securitySchemes:
    Bearer Authentication:
      type: http
      scheme: bearer
      bearerFormat: JWT