info:
  name: Set acquired appointments
  type: http
  seq: 2

http:
  method: PUT
  url: "{{elixFormsApiUrl}}/calendar/appointments/set-acquired/v1"
  headers:
    - name: x-requested-with
      value: XMLHttpRequest
  body:
    type: form-urlencoded
    data:
      - name: username
        value: "{{elixFormsApiUsername}}"
      - name: tag
        value: xyz
      - name: date
        value: "{{elixSetAcquiredAppointmentDate}}"
  auth: inherit

runtime:
  variables:
    - name: elixSetAcquiredAppointmentDate
      value: ""
  scripts:
    - type: before-request
      code: bru.setVar("elixSetAcquiredAppointmentDate", JSON.stringify(new Date().toISOString()));

settings:
  encodeUrl: true
  timeout: 0
  followRedirects: true
  maxRedirects: 5
  forwardAuthorizationHeader: true

examples:
  - name: Set acquired appointments - No timestamp?
    request:
      url: "{{elixFormsApiUrl}}/calendar/appointments/set-acquired/v1"
      method: PUT
      body:
        type: form-urlencoded
        data:
          - name: username
            value: "{{elixFormsApiUsername}}"
          - name: tag
            value: xyz
          - name: date
            value: "{{elixSetAcquiredAppointmentDate}}"
    response:
      statusText: "200"
      headers:
        - name: cache-control
          value: no-cache, no-store, must-revalidate
        - name: pragma
          value: no-cache
        - name: proxy-connection
          value: Keep-Alive
        - name: x-content-security-policy
          value: default-src 'self'; connect-src 'self'; font-src 'none'; img-src 'self'; media-src 'self'; object-src 'self'; plugin-types application/pdf audio/x-wav; referrer no-referrer; reflected-xss block; script-src 'self'; style-src 'self'
        - name: content-type
          value: application/json;charset=UTF-8
        - name: strict-transport-security
          value: max-age=63072000;includeSubDomains
        - name: content-security-policy
          value: "default-src https: data: 'unsafe-inline' 'unsafe-eval'"
        - name: x-frame-options
          value: SAMEORIGIN
        - name: x-xss-protection
          value: 1;mode=block
        - name: x-content-type-options
          value: nosniff
        - name: referrer-policy
          value: unsafe-url
        - name: transfer-encoding
          value: chunked
        - name: vary
          value: Accept-Encoding
        - name: content-encoding
          value: gzip
      body:
        type: json
        data: |-
          {
              "value": {
                  "code": "ERROR",
                  "description": "No timestamp provided in form params",
                  "complete": false,
                  "globalStatus": "ERROR",
                  "resultNumber": -1,
                  "uuid": "58bbd1b4-6abc-474a-89ac-ac55d203982b",
                  "version": "3.0.0",
                  "resultSize": 0
              }
          }
