How to pass complete body data from prior HTTP GET request into HTTP PUT request (with some minor changes)?

Trying to think through the best way to do this…

Basically, I need to make a PUT request to an endpoint with one or two minor changes. The rest of the data will remain the same as it originally exists just a moment before. Since the data will vary depending on the endpoint and what currently exists, my thoughts for the best way to accomplish this are as follows (just not sure how to translate into my Scenario completely).

  1. HTTP GET
  2. Text aggregator (or similar) to extract the entire body response json {xxxx}
  3. Output of this entire body as w/ ability to remap only particular parts of the body that I assign, let’s say adding a new “variable_4_value” = “new_input” for example, along with changing “variable_3_value” = “updated_value”.
  4. HTTP PUT with new body json (old + whatever variables I changed).

The key is for it to be dynamic (+my variable changes), since some fields may be added/removed later, so it should always use whatever comes from the initial GET request to ensure accuracy and that no data gets left out during PUT update.

However, I’m stuck on basically everything from 2-4. I know I can map the json manually, but there are hundreds of lines in the body, and again, it will change from time to time, so I definitely don’t want to go that route. And if I can extract the body text, that solves the first problem, but then how do redefine a variable value, or add a new one then merge that change into the existing body for the PUT request?

Thanks in advance for your input! (No scenario because it’s not built yet, but I’ve attached the sample output bundle from the GET request, and a sample input bundle that I want to use for my PUT request. In this specific example, the only variable I need to change is adding a “jobId” which I’m mapping from a prior step.

PUT_Input.json (2.4 KB)
GET_Output.json (7.3 KB)

Welcome to the Make community!

This might not be necessary, since the HTTP module does not parse response by default, so you already have access to the JSON string.

You’ll need to provide example original JSON and example sample of the changed JSON.

Please provide the input and output bundles of the modules by running the scenario (or get from the scenario History tab), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.
Screenshot_2023-10-06_141025

A.

Save each bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.

Uploading them here will look like this:

module-1-input-bundle.txt (12.3 KB)
module-1-output-bundle.txt (12.3 KB)

B.

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles in this manner:

  • Either add three backticks ``` before and after the code, like this:

    ```
    input/output bundle content goes here
    ```

  • Or use the format code button in the editor:
    Screenshot_2023-10-02_191027

Providing the input/output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

This will allow others to better assist you. Thanks!

1 Like

Just updated post with input/output bundles.