Question

A360 API Response to Variable

  • 18 January 2023
  • 2 replies
  • 23 views

Badge +5

Hello, 

 

I am currently looking to work with a United Health Care API. When testing with their lower environment and reviewing Automation Anywhere documentation, it appears the only way to get the body of the response is to log it to a file. Is there anyway to break it down into getting the whole body as a variable? Or can we break it down even further and get specific info from the body to a variable. We followed this documentation to log to file: https://docs.automationanywhere.com/bundle/enterprise-v2019/page/enterprise-cloud/topics/aae-client/bot-creator/using-the-workbench/cloud-using-get-action.html

 

One of the other things we tried was to take the output variable and break everything down even smaller to make it $APIOutput{"Body.apivariable"}$ but that returned a null response. If anyone has any tips or tricks that would be greatly helpful! 


2 replies

Userlevel 4
Badge +9

@Jacob Gunn check if this can help 

  • Output variable: The response output is captured in a dictionary variable. A dictionary variable is a key-value pair. Use the response header name as key to return the header value, or "Body" as the key to return the response body.

    Note:The response key with its value is available in the dictionary variable to display the response status of the REST API.

    To obtain a list of the header names for the API resource, perform these steps:
    1. Insert a Loop action after the REST Web Service action.
    2. Select the For each key in the dictionary iterator.
    3. In the Dictionary variable field, select the variable that holds the REST Web Service action output.
    4. Assign the value of each key to $prompt-assignment$.
    5. Insert a Log To File action.
    6. Provide the file path to a text file to hold the list of header names.
    7. Insert $prompt-assignment$ in the Enter text to log field.
    8. Select the Overwrite existing file option.
    9. Click Save.

      When you run the bot, it prints the header names from the API resource to the selected file.

Userlevel 5
Badge +9

Hi @Jacob Gunn 

Yes its possible, checkout below tutorials,

 

Reply