• ask chemistry
  • NEWBIE
  • 0 Points
  • Member since 2023

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies

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"})


 
TCPIP vs external interrupt
Why running TCPIP inserts random delays into the external interrupt response time. External interrupt has priority 7 and uses SRS. Nothing else with priority 7.  The TCPIP server is a Harmony example.
If the server is not running, the external interrupt delay is constant  (1us).
After starting the server, it changes between 1 - 2 us.
I do not know what to try anymore.