Questions on API Integration: Methods, URL Generation, and Error Handling

  1. How can I determine which HTTP method was used to call a flow that is configured to publish as an API?
  2. Why doesn't the GET URL generate when we have complex types defined as input for the flow?
  3. Can we retrieve only user-defined integrations using /APIDOC?
  4. The set of parameters defined for POST requests are not required for GET requests but still appear in the URL. Why is this?
  5. How can I generate a 404 API response?


Comments

  • Following are the details\answers for the above questions regarding API integration:-

    1. In the Data Explorer under Flow Data > HttpMethod, we can find a Flow Constant Data named "HttpMethod". This contains the HTTP method (GET, POST, PUT) used to call the flow.
    2. The GET URL will not be generated for flows where complex input types are defined. This is because JSON data is required to supply composite types, which cannot be effectively passed through a query string designed for basic types. For example, a basic type URL looks like this: site?input1=value1&input2=value2. However, for complex data, nesting and JSON parsing are necessary, which isn't feasible in URLs. An example of such a URL would be: site?data={inputs: [ {input1: value1},{input2: value2} ] }.
    3. Currently, we cannot ensure that only user-defined integrations will appear using APIDOC (/apidoc), as this functionality operates in a default manner that we do not control.
    4. It's expected that variables appear in the query string of a GET URL. This is standard for GET requests, where all inputs or data are part of the URL itself.
    5. To generate a 404 API response, we can utilize the "Throw API Exception" step, which fulfills this requirement effectively.
Sign In or Register to comment.