cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

HTTP Connection in API Fields

Hi All, I am having trouble understanding how to use the HTTP connector. I am able to obtain an output however the output is not formatted properly to identify the relevant fields. The response is altogether as follows:

"<Response api-method="List"><Status>OK</Status><Clients><Client><ID>14168610</ID><Name>Removed</Name><Title>MS</Title><Gender>F</Gender><FirstName>Removed</FirstName><LastName>Removed</LastName><DateOfBirth>1976-09-28T00:00:00</DateOfBirth><Address>Remove</Address><City>MAYFIELD</City><Region>NSW</Region><PostCode>2304</PostCode><Country>Australia</Country><PostalAddress>"

However usually the body output looks like this:

{
  "@odata.context""https://excelconnectionprovider-australiaeast.sy3-ase-001.p.azurewebsites.net/$metadata#datasets('01RYUO2IJLHAKFZKE4HVDZZPCB7MIK5P6T')/tables('Table1')/items",
  "value": [
    {
      "@odata.etag""",
      "ItemInternalId""6tY2pANG_EM",
      "Sender_x0020_Name""removed ",
      "Sender_x0020_Email""removed",
      "Category""Yes",
      "__PowerAppsId__""6tY2pANG_EM"
    },

How do I get the HTTP connect to present an array output in a format such as:
 {
Client
Field: Value
Field: Value
/Client

Client

Field: Value
Field: Value
/Client
    }


As opposed to what I am currently getting which is "client field: value field: value /client client field: value field: value /client"

What are the Headers? What is the Key & Value? Do I need to include something in here to get the proper formatting on the output?

flow http.png


4 REPLIES 4
Highlighted
Community Support
Community Support

Re: HTTP Connection in API Fields

Hi @pladavm,

 

Could you please show full details about the output that your HTTP action returned?

Do you want to format the response as an array output?

 

You could consider take a try to add a json object within Body field of HTTP action as below:17.JPG

Within Body field, type the following formula:

{
"Clients": [
                {
                   "ID": "Client ID1",
                   "Name": "Client Name",
                   "Title": "Client Title1",
                   "Gender":"Gender1",
"Field Name": "Field Value" }, { "ID":"Client ID2", "Name": "Client Name2", "Title": "Client Title2", "Gender": "Gender2",
"Field Name": "Field Value" } ] }

Note: Within Field Value, you could set example value, it is not necessary to be set a specific value.

 

Best regards,

Kris 

 

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Helper V
Helper V

Re: HTTP Connection in API Fields

Thank you @v-xida-msft do I need to do something different if the HTTP is a Trigger GET request? I seem to be getting this error message:

BadRequest. The provided 'Http' trigger inputs are not valid. A request body must not be included for 'GET' requests.

Highlighted
Helper V
Helper V

Re: HTTP Connection in API Fields

Hi @v-xida-msft here is example data which is only sample data (not real). How do I define this to present Array Output? Specifically when we get to the Account Manager heading (it seems to be second category heading?) 

<Client><ID>14221229</ID><Name>PLAUT, DAVID MATTHEW</Name><Title>MR</Title><Gender>M</Gender><FirstName>DAVID</FirstName><LastName>SMITH</LastName><OtherName>MATTHEW</OtherName><Email>PLADAVM@GMAIL.COM</Email><DateOfBirth>1985-06-19T00:00:00</DateOfBirth><Address>26b Bertram St </Address><City>DIANELLA</City><Region>WA</Region><PostCode>6059</PostCode><Country>Australia</Country><PostalAddress></PostalAddress><PostalCity></PostalCity><PostalRegion></PostalRegion><PostalPostCode></PostalPostCode><PostalCountry></PostalCountry><Phone>0422077992</Phone><Fax></Fax><Website></Website><ReferralSource></ReferralSource><ExportCode></ExportCode><IsProspect>No</IsProspect><IsArchived>No</IsArchived><IsDeleted>No</IsDeleted><AccountManager><ID>541415</ID><Name>David Plaut</Name></AccountManager><JobManager><ID>541415</ID><Name>David Plaut</Name></JobManager><TaxNumber>389 966 541</TaxNumber><CompanyNumber></CompanyNumber><BusinessNumber></BusinessNumber><BranchNumber>1</BranchNumber><BusinessStructure>Individual</BusinessStructure><GSTRegistered>No</GSTRegistered><PrepareGST>No</PrepareGST><SignedTaxAuthority>Yes</SignedTaxAuthority><TaxAgent>Poetic Reports Pty Ltd</TaxAgent><AgencyStatus>Unlinked</AgencyStatus><PrepareActivityStatement>No</PrepareActivityStatement><PrepareTaxReturn>Yes</PrepareTaxReturn><BankBSB>999177</BankBSB><BankAccountName>DAVID SMITH</BankAccountName><BankAccountNumber>39987755</BankAccountNumber><BankName>ING</BankName><ActiveAtoClient>Yes</ActiveAtoClient><Contacts /><UUID>8f5ac891-dd83-412f-8c28-a548670d14b1</UUID></Client><Client><ID>14221197</ID><Name>Poetic Reports Pty Ltd</Name><Email>davidplaut@wlas.com.au</Email><Address>16b Perth St </Address><City>PERTH</City><Region>WA</Region><PostCode>6000</PostCode><Country>Australia</Country><PostalAddress></PostalAddress><PostalCity></PostalCity><PostalRegion></PostalRegion><PostalPostCode></PostalPostCode><PostalCountry></PostalCountry><Phone>0400999112</Phone><Fax></Fax><Website></Website><ReferralSource></ReferralSource><ExportCode></ExportCode><IsProspect>No</IsProspect><IsArchived>No</IsArchived><IsDeleted>No</IsDeleted><AccountManager><ID>541415</ID><Name>David Plaut</Name></AccountManager><JobManager><ID>541415</ID><Name>David Plaut</Name></JobManager><TaxNumber>477 844 626</TaxNumber><CompanyNumber>668 999 531</CompanyNumber><BusinessNumber>72 699 888 599</BusinessNumber><BranchNumber>1</BranchNumber><BusinessStructure>Company</BusinessStructure><BalanceMonth>6</BalanceMonth><GSTRegistered>No</GSTRegistered><PrepareGST>No</PrepareGST><SignedTaxAuthority>Yes</SignedTaxAuthority><TaxAgent>Poetic Reports Pty Ltd</TaxAgent><AgencyStatus>Unlinked</AgencyStatus><PrepareActivityStatement>No</PrepareActivityStatement><PrepareTaxReturn>Yes</PrepareTaxReturn><ActiveAtoClient>Yes</ActiveAtoClient><Contacts /><UUID>86ecab10-3a92-447e-ac08-c97060c611fd</UUID></Client>

Also noting at the very beginning before listing all the client details it has <Response api-method="List"><Status>OK</Status><Clients> and at the very end is has </Clients>

Highlighted
Helper V
Helper V

Re: HTTP Connection in API Fields

Do you think I need to use a formula called "xpath"? @v-xida-msftSee this article: https://powerusers.microsoft.com/t5/Building-Flows/Using-xPath-on-an-HTTP-xml-body/td-p/73531

I tired to work out the xpath formula but having difficulty. Can you help? 

Helpful resources

Announcements
firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Users online (9,568)