function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Matt JB RobertsMatt JB Roberts 

External service API schema: Response handling

I'm struggling to set the correct API response schema when writing an OpenAPI spec for External Services (it's my first time doing this).

For context, the use case is validating the UK VAT registration number on our account record by making a callout to the HMRC API.

The source code is below, with the API JSON response at the bottom.

The service is invoked from a Flow. The call goes out successfully. The input parameters are working fine and the API returns a 200 response, along with the required data.

Now, I want to use the data in the response to update the record, but I can't get this bit to work! The 200 response is there as a string, but I can't extract the keys/values for use in the flow.

Can anyone suggest how to fix for this schema, so that I can access the values nested in the response?
 

JSON API spec

{
  "swagger": "2.0",
  "info": {
    "description": "HMRC VAT number check",
    "version": "1.0.0",
    "title": "HMRC VAT number check"
  },
  "host": "api.service.hmrc.gov.uk",
  "schemes":"https",
  "paths": {
    "/organisations/vat/check-vat-number/lookup/{targetVrn}/{requesterVrn}": {
      "get": {
        "summary": "Check a UK VAT number",
        "description": "Get reference number to prove you checked a UK VAT number",
        "produces": [
          "application/json"
        ],
        "parameters": [{
          "in": "path",
          "name": "targetVrn",
          "required": true,
          "type": "string"
        },{
          "in": "path",
          "name": "requesterVrn",
          "required": true,
          "type": "string"
        }],
        "responses": {
          "200": {
            "description": "success",
            "content":{
              "application/json":{
                "schema":{
                  "type": "object",
                  "properties": {
                    "target": {
                      "type": "object",
                      "default": {},
                      "title": "The target Schema",
                      "properties": {
                        "name": {
                          "type": "string",
                          "default": "",
                          "title": "The name Schema"
                        },
                        "vatNumber": {
                          "type": "string",
                          "default": "",
                          "title": "The vatNumber Schema"
                        },
                        "address": {
                          "type": "object",
                          "default": {},
                          "title": "The address Schema",
                          "properties": {
                            "line1": {
                              "type": "string",
                              "default": "",
                              "title": "The line1 Schema"                              
                            },
                            "line2": {
                              "type": "string",
                              "default": "",
                              "title": "The line2 Schema"
                            },
                            "line3": {
                              "type": "string",
                              "default": "",
                              "title": "The line3 Schema"
                            },
                            "postcode": {
                              "type": "string",
                              "default": "",
                              "title": "The postcode Schema"
                            },
                            "countryCode": {
                              "type": "string",
                              "default": "",
                              "title": "The countryCode Schema"
                            }
                          }
                        }
                      }
                    },
                    "requester": {
                      "type": "string",
                      "default": "",
                      "title": "The requester Schema"
                    },
                    "consultationNumber": {
                      "type": "string",
                      "default": "",
                      "title": "The consultationNumber Schema"
                    },
                    "processingDate": {
                      "type": "string",
                      "default": "",
                      "title": "The processingDate Schema"
                    }
                  }
                }  
              }
            }
          }
        }
      }
    }
  }
}

API response shown in flow debug
Outputs

200 ({"target":{"name":"HUBOO TECHNOLOGIES LIMITED","vatNumber":"292481090","address":{"line1":"41 CORN STREET","line2":"BRISTOL","line3":"BRISTOL","postcode":"BS1 1HT","countryCode":"GB"}},"requester":"292481090","consultationNumber":"nhm-vMg-TMO","processingDate":"2022-09-27T13:25:35+01:00"})


 
David RonaldDavid Ronald

Just rename Launch Apex Replay Deburgger to Survey, Our website is useful to take part in the survey Kohls Feedback (https://www.kohlsfeedbackscom.com)
ask chemistryask chemistry
موقع تعرف على علم الكيمياء (https://learnchemistry12.com) لشرح الكيمياء العضوية - الكيمياء العامة - الكيمياء التحليلية - الكيمياء الفيزيائية - الكيمياء الحيوية - الكيمياء الكهربية.

موقع (https://ask-chemistry.com)اسألني كيمياء (https://ask-chemistry.com) هو موقع الكتروني لطرح السؤال والإجابة في الكيمياء العضوية - الكيمياء العامة - الكيمياء التحليلية - الكيمياء الفيزيائية - الكيمياء الحيوية - الكيمياء الكهربية.

موقع مصطلحات كيميائية (https://learnchemistry13.com) هو موقع تعليمي لتبسيط المصطلحات الكيميائية ووضعها في صور في الكيمياء العضوية - الكيمياء العامة - الكيمياء التحليلية - الكيمياء الفيزيائية - الكيمياء الحيوية - الكيمياء الكهربية.

ReadChemistry.com is A window for learning Chemistry (https://readchemistry.com): Organic Chemistry, Analytical Chemistry, Physical Chemistry, General Chemistry and download free Chemistry books.

لطرح الأسئلة في الكيمياء:
موقع/ اسألني كيمياء
https://ask-chemistry.com

لتحميل الكتب الكيميائية وشرح موضوعات الكيمياء المختلفة:
موقع / تعرف على علم الكيمياء
https://learnchemistry12.com

لتصفح المصطلحات الكيميائية:
موقع / مصطلحات كيميائية
https://learnchemistry13.com

لشرح موضوعات الكيمياء باللغة الإنجليزية:
موقع / Read Chemistry
https://readchemistry.com