post:
  operationId: createSubscription
  tags:
    - Triggers
  summary: Create a Subscription
  description: >-
    This API creates a new subscription to a trigger and defines trigger invocation details. The type of subscription determines which config object is required:

    * HTTP subscriptions require httpConfig
   
    * EventBridge subscriptions require eventBridgeConfig
  requestBody:
    required: true
    content:
      application/json:
        schema:
          $ref: '../schemas/SubscriptionPostRequest.yaml'
        examples:
          HTTP Subscription:
            value:
              name: Access request subscription
              description: Access requested to site xyz
              triggerId: idn:access-requested
              type: HTTP
              httpConfig:
                url: https://www.example.com
                httpDispatchMode: SYNC
                httpAuthenticationType: BASIC_AUTH
                basicAuthConfig:
                  userName: user@example.com
                  password: eRtg4%6yuI!
              enabled: true
              filter: $[?($.identityId == "201327fda1c44704ac01181e963d463c")]
          HTTP Async Subscription:
            value:
              name: Access request subscription
              description: Access requested to site xyz
              triggerId: idn:access-requested
              type: HTTP
              responseDeadline: "PT1H"
              httpConfig:
                url: https://www.example.com
                httpDispatchMode: ASYNC
                httpAuthenticationType: BASIC_AUTH
                basicAuthConfig:
                  userName: user@example.com
                  password: eRtg4%6yuI!
              enabled: true
              filter: $[?($.identityId == "201327fda1c44704ac01181e963d463c")]
          EventBridge Subscription:
            value:
              name: Access request subscription
              description: Access requested to site xyz
              triggerId: idn:access-requested
              type: EVENTBRIDGE
              eventBridgeConfig:
                awsAccount: '123456789012'
                awsRegion: us-west-1
              enabled: true
              filter: $[?($.identityId == "201327fda1c44704ac01181e963d463c")]
  responses:
    '201':
      description: >-
        New subscription to a trigger. The trigger can now be invoked by the method defined in the subscription.
      content:
        application/json:
          schema:
            $ref: '../schemas/Subscription.yaml'
    '400':
      $ref: '../../v3/responses/400.yaml'
    '401':
      $ref: '../../v3/responses/401.yaml'
    '403':
      $ref: '../../v3/responses/403.yaml'
    '429':
      $ref: '../../v3/responses/429.yaml'
    '500':
      $ref: '../../v3/responses/500.yaml'
  security:
    - oauth2:
        - 'idn:trigger-service-subscriptions:create'
  
get:
  operationId: listSubscriptions
  tags:
    - Triggers
  summary: List Subscriptions
  description: Gets a list of all trigger subscriptions.
  parameters:
    - $ref: '../../v3/parameters/limit.yaml'
    - $ref: '../../v3/parameters/offset.yaml'
    - $ref: '../../v3/parameters/count.yaml'
    - in: query
      required: false
      name: filters
      schema:
        type: string
      description: >-
        Filter results using the standard syntax described in [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters#filtering-results)


        Filtering is supported for the following fields and operators:


        **id**: *eq*


        **triggerId**: *eq*


        **type**: *eq*
      example: id eq "12cff757-c0c0-413b-8ad7-2a47956d1e89"
    - in: query
      name: sorters
      required: false
      schema:
        type: string
        format: comma-separated
      description: >-
        Sort results using the standard syntax described in [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters#sorting-results)


        Sorting is supported for the following fields:


        **triggerId**
        **triggerName**
      example: triggerName
  responses:
    '200':
      description: List of subscriptions.
      content:
        application/json:
          schema:
            type: array
            items:
              $ref: '../schemas/Subscription.yaml'
          examples:
            HTTP Subscription:
              value:
                - id: 0f11f2a4-7c94-4bf3-a2bd-742580fe3bde
                  name: Access request subscription
                  description: Access requested to site xyz
                  triggerId: idn:access-requested
                  triggerName: Access Requested
                  type: HTTP
                  httpConfig:
                    url: https://www.example.com
                    httpDispatchMode: SYNC
                    httpAuthenticationType: BASIC_AUTH
                    basicAuthConfig:
                      userName: user@example.com
                      password: null
                  enabled: true
                  filter: $[?($.identityId == "201327fda1c44704ac01181e963d463c")]
            HTTP Async Subscription:
              value:
                name: Access request subscription
                description: Access requested to site xyz
                triggerId: idn:access-requested
                triggerName: Access Requested
                type: HTTP
                responseDeadline: "PT1H"
                httpConfig:
                  url: https://www.example.com
                  httpDispatchMode: ASYNC
                  httpAuthenticationType: BASIC_AUTH
                  basicAuthConfig:
                    userName: user@example.com
                    password: null
                enabled: true
                filter: $[?($.identityId == "201327fda1c44704ac01181e963d463c")]
            EventBridge Subscription:
              value:
                - id: 0f11f2a4-7c94-4bf3-a2bd-742580fe3bde
                  name: Access request subscription
                  description: Access requested to site xyz
                  triggerId: idn:access-requested
                  triggerName: Access Requested
                  type: EVENTBRIDGE
                  eventBridgeConfig:
                    awsAccount: '123456789012'
                    awsRegion: us-west-1
                  enabled: true
                  filter: $[?($.identityId == "201327fda1c44704ac01181e963d463c")]
    '400':
      $ref: '../../v3/responses/400.yaml'
    '401':
      $ref: '../../v3/responses/401.yaml'
    '403':
      $ref: '../../v3/responses/403.yaml'
    '429':
      $ref: '../../v3/responses/429.yaml'
    '500':
      $ref: '../../v3/responses/500.yaml'
  security:
    - oauth2:
        - 'idn:trigger-service-subscriptions:read'
