cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

REST API - ClearCollect returns "True"

Hello all,

I'm relatively new to REST API's and Power Automate. I've got myself to a certain point where I cannot find out where I am going wrong and I think it is in the output of the API.

 

I have a ClearCollect run against a Flow that I have created. The Flow is successfully grabbing the record. It grabs the Body and puts it into PowerApps.

 

However, the collection is just returning a column titled "Value" and then the only row says "True".

 

What you may also note is that this is a sales transaction, where one transaction can have many products so I am not sure if this should be taken into account when it comes to how the information is being parsed.

 

From this output, I would want to be grabbing "Sales Header" information (where it relates to overall information of the sale like the customer, address, the balance outstanding, etc) and then each instance of the product (each "line" of the transaction).

 

  1. How do I get the below information into a collection within PowerApps (type in "ID" query - brings up customer information and sales information).
  2. How can I bring the information in an easy to read format (I tried to bring it in separating out the fields but that would have multiples of "key", not necessarily split out by the value of the key.)

Below are the outputs from Automate (sans sensitive data).

 

Headers
Link
<http://#######/salesorder?$schema=PUT>; rel="describedBy"; method="PUT",<http://######/salesorder?$schema=POST>; rel="describedBy"; method="POST"
Date
Mon, 03 Feb 2020 02:52:05 GMT
Server
Microsoft-HTTPAPI/2.0
Content-Type
application/json; charset=utf-8
Content-Length
10949
{
  "debtorid": 24576,
  "lines": [
    {
      "stockcode": "CRDCDC145589",
      "isoriginatedfromtemplate": false,
      "orderquantity": 1,
      "discount": 0,
      "unitprice": ######,
      "ispriceoverridden": true,
      "locationid": 2,
      "taxrateid": 10,
      "listprice": #######,
      "pricepolicyid": 0,
      "linetype": 0,
      "uninvoicedquantity": 0,
      "releasequantity": 0,
      "releasenowquantity": 1,
      "lastreleasedquantity": 0,
      "pickedquantity": 0,
      "picknowquantity": 1,
      "lastpickedquantity": 0,
      "stocktype": "PhysicalItem",
      "id": 300858,
      "branchid": 2,
      "taxratevalue": 10,
      "istaxoverridden": false,
      "taxoverridevalue": 0,
      "narrative": null,
      "backorderquantity": 0,
      "description": "133798 - DESIGNER BASE SKB BASE-MYSTERE EBONY",
      "batchcode": "",
      "duedate": "2020-02-21",
      "linetotal": ####,
      "invoicedquantity": 0,
      "invoicenowquantity": 0,
      "lastinvoicedquantity": 0,
      "suppliedquantity": 0,
      "supplynowquantity": 0,
      "lastsuppliedquantity": 0,
      "restrictedline": false,
      "rankorder": 1,
      "extrafields": [
        {
          "key": "X_SOLD_STICKER_PRINTED",
          "value": null
        },
        {
          "key": "X_DO_NOT_DELIVER",
          "value": "N"
        },
        {
          "key": "X_ALLOC_DATE",
          "value": "Jan 13 2020 12:00PM"
        },
        {
          "key": "X_SALE_DATE",
          "value": "2019-10-21"
        },
        {
          "key": "X_DEPOSIT_DATE",
          "value": "2019-10-21"
        },
        {
          "key": "X_PRIORITY_RELEASE",
          "value": "N"
        },
        {
          "key": "X_QFF_PT_EARNED",
          "value": #####
        },
        {
          "key": "X_QFF_BONUS_PT",
          "value": 0
        },
        {
          "key": "X_QFF_PT_MULTIPLIER",
          "value": 1
        },
        {
          "key": "X_QFF_DEF_MULTIPLIER",
          "value": 1
        }
      ]
    },
    {
      "stockcode": "KIMY149741GRNR",
      "isoriginatedfromtemplate": false,
      "orderquantity": 1,
      "discount": 0,
      "unitprice": ######,
      "ispriceoverridden": true,
      "locationid": 2,
      "taxrateid": 10,
      "listprice": ######,
      "pricepolicyid": 0,
      "linetype": 0,
      "uninvoicedquantity": 0,
      "releasequantity": 0,
      "releasenowquantity": 1,
      "lastreleasedquantity": 0,
      "pickedquantity": 0,
      "picknowquantity": 1,
      "lastpickedquantity": 0,
      "stocktype": "PhysicalItem",
      "id": 300859,
      "branchid": 2,
      "taxratevalue": 10,
      "istaxoverridden": false,
      "taxoverridevalue": 0,
      "narrative": "GREEN/RED",
      "backorderquantity": 0,
      "description": "MYSIDE SERIES 6 SKB MATTRESS GREEN/RED",
      "batchcode": "",
      "duedate": "2020-02-21",
      "linetotal": #####,
      "invoicedquantity": 0,
      "invoicenowquantity": 0,
      "lastinvoicedquantity": 0,
      "suppliedquantity": 0,
      "supplynowquantity": 1,
      "lastsuppliedquantity": 0,
      "restrictedline": false,
      "rankorder": 2,
      "extrafields": [
        {
          "key": "X_SOLD_STICKER_PRINTED",
          "value": null
        },
        {
          "key": "X_DO_NOT_DELIVER",
          "value": "N"
        },
        {
          "key": "X_ALLOC_DATE",
          "value": "Jan  7 2020  4:00PM"
        },
        {
          "key": "X_SALE_DATE",
          "value": "2019-10-21"
        },
        {
          "key": "X_DEPOSIT_DATE",
          "value": "2019-10-21"
        },
        {
          "key": "X_PRIORITY_RELEASE",
          "value": "N"
        },
        {
          "key": "X_QFF_PT_EARNED",
          "value": ######
        },
        {
          "key": "X_QFF_BONUS_PT",
          "value": 0
        },
        {
          "key": "X_QFF_PT_MULTIPLIER",
          "value": 1
        },
        {
          "key": "X_QFF_DEF_MULTIPLIER",
          "value": 1
        }
      ]
    },
    {
      "stockcode": "AUTOFREIGHT",
      "isoriginatedfromtemplate": false,
      "orderquantity": 1,
      "discount": 0,
      "unitprice": 0,
      "ispriceoverridden": false,
      "locationid": 2,
      "taxrateid": 10,
      "listprice": 0,
      "pricepolicyid": 0,
      "linetype": 0,
      "uninvoicedquantity": 0,
      "releasequantity": 0,
      "releasenowquantity": 1,
      "lastreleasedquantity": 0,
      "pickedquantity": 0,
      "picknowquantity": 0,
      "lastpickedquantity": 0,
      "stocktype": "LookupItem",
      "id": 300860,
      "branchid": 2,
      "taxratevalue": 10,
      "istaxoverridden": false,
      "taxoverridevalue": 0,
      "narrative": null,
      "backorderquantity": 0,
      "description": "DELIVERY FEE (Installation NOT included)",
      "batchcode": "",
      "duedate": "2020-02-21",
      "linetotal": 0,
      "invoicedquantity": 0,
      "invoicenowquantity": 0,
      "lastinvoicedquantity": 0,
      "suppliedquantity": 0,
      "supplynowquantity": 0,
      "lastsuppliedquantity": 0,
      "restrictedline": false,
      "rankorder": 3,
      "extrafields": [
        {
          "key": "X_SOLD_STICKER_PRINTED",
          "value": null
        },
        {
          "key": "X_DO_NOT_DELIVER",
          "value": "N"
        },
        {
          "key": "X_ALLOC_DATE",
          "value": null
        },
        {
          "key": "X_SALE_DATE",
          "value": "2019-10-21"
        },
        {
          "key": "X_DEPOSIT_DATE",
          "value": "2019-10-21"
        },
        {
          "key": "X_PRIORITY_RELEASE",
          "value": "N"
        },
        {
          "key": "X_QFF_PT_EARNED",
          "value": 0
        },
        {
          "key": "X_QFF_BONUS_PT",
          "value": 0
        },
        {
          "key": "X_QFF_PT_MULTIPLIER",
          "value": 0
        },
        {
          "key": "X_QFF_DEF_MULTIPLIER",
          "value": 0
        }
      ]
    },
    {
      "stockcode": "CRDCDCBERKSKB",
      "isoriginatedfromtemplate": false,
      "orderquantity": 1,
      "discount": 0,
      "unitprice": #####,
      "ispriceoverridden": true,
      "locationid": 2,
      "taxrateid": 10,
      "listprice": #####,
      "pricepolicyid": 0,
      "linetype": 0,
      "uninvoicedquantity": 0,
      "releasequantity": 0,
      "releasenowquantity": 1,
      "lastreleasedquantity": 0,
      "pickedquantity": 0,
      "picknowquantity": 1,
      "lastpickedquantity": 0,
      "stocktype": "PhysicalItem",
      "id": 300897,
      "branchid": 2,
      "taxratevalue": 10,
      "istaxoverridden": false,
      "taxoverridevalue": 0,
      "narrative": null,
      "backorderquantity": 0,
      "description": "Berkshire Super King Bedhead (core fabric pricing)",
      "batchcode": "",
      "duedate": "2020-02-21",
      "linetotal": 1829,
      "invoicedquantity": 0,
      "invoicenowquantity": 0,
      "lastinvoicedquantity": 0,
      "suppliedquantity": 0,
      "supplynowquantity": 0,
      "lastsuppliedquantity": 0,
      "restrictedline": false,
      "rankorder": 4,
      "extrafields": [
        {
          "key": "X_SOLD_STICKER_PRINTED",
          "value": null
        },
        {
          "key": "X_DO_NOT_DELIVER",
          "value": "N"
        },
        {
          "key": "X_ALLOC_DATE",
          "value": "Jan 13 2020 12:00PM"
        },
        {
          "key": "X_SALE_DATE",
          "value": "2019-10-21"
        },
        {
          "key": "X_DEPOSIT_DATE",
          "value": "2019-10-21"
        },
        {
          "key": "X_PRIORITY_RELEASE",
          "value": "N"
        },
        {
          "key": "X_QFF_PT_EARNED",
          "value": 1829
        },
        {
          "key": "X_QFF_BONUS_PT",
          "value": 0
        },
        {
          "key": "X_QFF_PT_MULTIPLIER",
          "value": 1
        },
        {
          "key": "X_QFF_DEF_MULTIPLIER",
          "value": 1
        }
      ]
    }
  ],
  "taxrounding": -0.01,
  "deliverycount": 0,
  "invoicecount": 0,
  "pickedcount": 0,
  "releasecount": 0,
  "hasuninvoiced": true,
  "hasunpicked": true,
  "hasunreleased": true,
  "hasunsupplied": true,
  "allowcustomerordernumber": false,
  "customerordernumber": "",
  "accountname": "CUSTOMER NAME",
  "istaxinclusive": true,
  "hasbackorders": false,
  "branchid": 2,
  "defaultlocationid": 2,
  "narrative": null,
  "currencyid": 0,
  "contactid": -1,
  "salespersonid": 3383,
  "exchangerate": 1,
  "taxtotal": 587.36,
  "subtotal": 5873.64,
  "reference": null,
  "instructions": null,
  "createdate": "2019-10-21T15:15:32+11:00",
  "orderdate": "2019-10-21",
  "duedate": "2020-02-21",
  "finalisationdate": null,
  "activationdate": "2019-10-21T15:15:32+11:00",
  "deliveryaddress": {
    "line1": "CUSTOMER",
    "line2": "123 FAKE STREET",
    "line3": "",
    "line4": "FAKE SUBURB",
    "line5": "3000",
    "line6": "04000000"
  },
  "status": 0,
  "statusdescription": "Unprocessed Order",
  "finalised": 0,
  "ordertotal": ####,
  "localvalue": ####,
  "hasrestrictedline": false,
  "lastupdated": "2020-02-03T13:45:26.593+11:00",
  "extrafields": [
    {
      "key": "X_DELIVERY_STATUS_SEQNO",
      "value": 7
    },
    {
      "key": "MANIFEST",
      "value": 1569
    },
    {
      "key": "X_CUST_PHONE",
      "value": "#######"
    },
    {
      "key": "X_OVERRIDE_SALESNO",
      "value": -1
    },
    {
      "key": "X_DELIVERY_SLOT",
      "value": -1
    },
    {
      "key": "X_PICKUP",
      "value": "N"
    },
    {
      "key": "X_PICKUP_LOCATION",
      "value": -1
    },
    {
      "key": "X_PICKUP_DATE",
      "value": "2019-10-21"
    },
    {
      "key": "X_DEPOSIT_VAL",
      "value": #####
    },
    {
      "key": "X_BALANCE",
      "value": ######
    },
    {
      "key": "X_CANCEL_ORDER",
      "value": "N"
    },
    {
      "key": "X_QFF_MEMBERID",
      "value": null
    },
    {
      "key": "X_QFF_SURNAME",
      "value": null
    },
    {
      "key": "X_QFF_VALIDATED",
      "value": null
    },
    {
      "key": "X_UPD_MEMBERSHIP_DETAILS",
      "value": " "
    },
    {
      "key": "X_UPDATE_QFF_PT_EARNED",
      "value": " "
    }
  ],
  "id": 24110,
  "href": "http://#######/salesorder/24110"
}

 

 

4 REPLIES 4
Highlighted
Super User
Super User

Re: REST API - ClearCollect returns "True"

Are you using a 'Response' card at the end of your Flow? If so, are you feeding it a JSON schema?

See here:

https://powerapps.microsoft.com/en-us/blog/return-an-array-from-flow-to-powerapps-response-method/

---
If this answered your question, please click "Accept Solution". If this helped, please Thumbs Up.

Highlighted
Frequent Visitor

Re: REST API - ClearCollect returns "True"

Hi Eric,

 

I had this wonderful, beautiful and eloquent response to your questions. As I clicked on submit, there was an authentication token issue and I lost it all. So, I'll be a little more brief to your question.

 

Yes, I am. I followed this tutorial that suggests a JSON Parse, then into the Response step.

 

https://youtu.be/z8xwb8O_T30?t=327

 

There have been three different schemas that I have generated, all with their own issues.

 

  1. Power Automate "Generate from Example" - I don't think it fully develops the schema. It misses many of the "extra field" responses that come out of the body.
  2. jsonschema.net - Looks like the nicest and cleanest schema, but Power Automate brings up two error messages
    1. Does not support property "pattern" in Power Automate. Then I delete the Pattern Properties from the Schema;
    2. I am then told that it is not a valid JSON schema.
  3. Software Vendor Supplied Schema - Passes through Automate fine without error messages. It just turns up in Powerapps as a "Value - True" table. Outputs look correct and fine in the Automate test results.
Highlighted
Frequent Visitor

Re: REST API - ClearCollect returns "True"

Hi @EricLott,

I've just realised what is going on (I think).

 

There is an array within the JSON response called "extrafields" that the JSON schema generator is not splitting out (I think).

 

Would I be right in assuming this? And if so, do I then need to PARSE JSON of the "extrafields" from the PARSE JSON already done?

Highlighted
Frequent Visitor

Re: REST API - ClearCollect returns "True"

I'm now finding articles that I think properly describe the issue that I am dealing with, but I am having trouble understanding what's going on.

https://powerusers.microsoft.com/t5/Building-Flows/Parse-JSON-no-dynamic-content-from-array/m-p/3279...

 

"Nested Arrays" "Retrieving Inner Arrays" look like they're describing the issue that I think I am seeing.

 

Looks like Barry @v-bacao-msft in the article above might understand what's going on here? 

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (5,090)