Working with third-party APIs

SENDHTTPPOST sends a POST request to a URL and can receive a JSON response.

How does one:

  • parse the response to use the returned data?
  • send HTTP requests (PATCH, GET, DELETE, etc.)?
  • pass parameters via URL (“myserver/api/users/1” to retrieve/update user with id 1)?
  • set this up without hardcoding the URL?

Regarding hardcoding the URL: How am I supposed to promote a process from a test environment to production without editing the process and changing all the URLs?

Hi Brian

How does one:

  1. parse the response to use the returned data?

There are multiple ways of doing that. I have two examples

  • You can store that value in a hidden text field of the form and use Newtonsoft.Json library in the .NET editor to deserialize the object. Eg: Newtonsoft.Json.JsonConvert.DeserializeObject(HIDDEN_FIELD.Text)

  • You can also send the stored data to a custom assembly where the code in the assembly will handle deserializing the object and doing other functionalities.

  1. send HTTP requests (PATCH, GET, DELETE, etc.)?

We don’t have a built-in solution for this. You can either use the .NET editor or build a custom assembly application to send HTTP requests.

  1. pass parameters via URL (“myserver/api/users/1” to retrieve/update user with id 1)?
    I am not sure if you’re talking about changing the URL for the SENDHTTPPOST application. If that’s the case you can define the URL in a data and use that for the APP_URL parameter defined for the SENDHTTPPOST application.

  2. set this up without hardcoding the URL?
    Same answer as point 3.

Best Regards,
Eddy.