info:
  name: Clone Request
  type: http
  seq: 8

http:
  method: POST
  url: "{{elixFormsApiUrl_Default}}/request/:request_id/clone?username={{elixFormsApiUsername}}"
  headers:
    - name: x-requested-with
      value: XMLHttpRequest
    - name: x-api-key
      value: "{{elixFormsWsAuthenticationToken}}"
    - name: x-api-username
      value: "{{elixFormsApiUsername}}"
  params:
    - name: username
      value: "{{elixFormsApiUsername}}"
      type: query
    - name: request_id
      value: "7012"
      type: path
  body:
    type: json
    data: |-
      {
        "clientUsername": "MMMPPL74T17E463A", // string, <(*) username dell'utente che richiede la clonazione>
        "cloningReason": "Request cloning test", // string, <(*) motivazione della copia>
        "cloningDate": "{{elixRequestCloningDate}}", // dateTime, <(*) data in formato ISO: "2021-05-18T00:00:00">
        "cloneLogId": null // number, <generic id dello storico di clonazione eventualmente da aggiornare; se non specificato viene automaticamente generato un nuovo log (Scheda "RW2 - Clone")>
      }
  auth: inherit

runtime:
  variables:
    - name: elixRequestCloningDate
      value: ""
  scripts:
    - type: before-request
      code: |-
        var currentDate = new Date().toISOString();

        console.log(currentDate);

        bru.setVar("elixRequestCloningDate", JSON.stringify(currentDate));

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

examples:
  - name: Clone Request - Error
    request:
      url: "{{elixFormsApiUrl_Default}}/request/:request_id/clone?username={{elixFormsApiUsername}}"
      method: POST
      headers:
        - name: x-api-key
          value: "{{elixFormsWsAuthenticationToken}}"
        - name: x-api-username
          value: "{{elixFormsApiUsername}}"
      params:
        - name: username
          value: "{{elixFormsApiUsername}}"
          type: query
        - name: request_id
          value: "7007"
          type: path
      body:
        type: json
        data: "{\r

          \  \"clientUsername\": \"MMMPPL74T17E463A\", // string, <(*) username dell'utente che richiede la clonazione>\r

          \  \"cloningReason\": \"Request cloning test\", // string, <(*) motivazione della copia>\r

          \  \"cloningDate\": {{elixRequestCloningDate}}, // dateTime, <(*) data in formato ISO: \"2021-05-18T00:00:00\">\r

          \  \"cloneLogId\": null // number, <generic id dello storico di clonazione eventualmente da aggiornare; se non specificato viene automaticamente generato un nuovo log (Scheda \"RW2 - Clone\")>\r

          }"
    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": "Unmanaged exception thrown. Contact technical support.",
                  "complete": false,
                  "globalStatus": "ERROR",
                  "resultNumber": -1,
                  "serviceInformationList": {
                      "serviceInformation": [
                          {
                              "complete": false,
                              "serviceVersion": "V1",
                              "statusDetailList": {
                                  "statusDetail": [
                                      {
                                          "code": "500",
                                          "description": "[Internal Server Error] - IllegalArgumentException: No entity manager defined for named query \"lookupGalleryInfoByMetadataIdAndSchemaField\" of class \"com.anthesi.elixforms.core.entity.multitenancy.upload.GalleryInfoEntity\"",
                                          "detailStatus": "ERROR"
                                      }
                                  ]
                              }
                          }
                      ]
                  },
                  "uuid": "472dd247-f034-43c1-9633-32ea5cd5d817",
                  "version": "3.0.0"
              }
          }

docs: La chiamata assume che l'istanza in oggetto non sia in corso di compilazione.
