Help on a API Error - Composite End point

We are exporting invoice data to the composite end point.

We have 14 line items and are updating a document item tag on each line, all from within the one post.

 

I am getting the following error from the API

 

"errorCode":"LIMIT_EXCEEDED",

"message":"The request can’t contain more than 25 operations."

 

 

Can anyone suggest how we might able to use the composite end point to raise an invoice with this many lines?

Parents Reply Children
  • Thanks for replying. 

    My payload is attached

    compositeexample.json.txt
    {
      "allOrNone":true,
      "compositeRequest":[
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document__c",
                             "referenceId":"NewPurchaseInvoice",
                             "body":{
                                      "s2cor__Account__c":"0016F00002zcls3QAA",
                                      "s2cor__Trade_Document_Type__c":"a1w6F000009GjcfQAC",
                                      "s2cor__Company__c":"a1H6F0000067GdQUAU",
                                      "s2cor__Date__c":"2019-09-22",
                                      "s2cor__Reference__c":"20190922"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Tag__c",
                             "referenceId":"NewPurchaseInvoiceTag",
                             "body":{
                                      "s2cor__Trade_Document__c":"@{NewPurchaseInvoice.id}",
                                      "s2cor__Dimension__c":"a0D6F00000hSrqgUAC",
                                      "s2cor__Tag__c":"a146F000005QwiFQAS"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item__c",
                             "referenceId":"NewLineItem1",
                             "body":{
                                      "s2cor__Product__c":"01t6F00000AijXDQAZ",
                                      "s2cor__Trade_Document__c":"@{NewPurchaseInvoice.id}",
                                      "s2cor__Description__c":"Operations - GP",
                                      "s2cor__Unit_Price__c":77.27,
                                      "s2cor__Tax_Amount__c":7.73,
                                      "s2cor__Tax_Code__c":"a276F00000NiCmHQAV",
                                      "s2cor__Ledger_Account__c":"a0Y6F00000LZLolUAH"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item_Tag__c",
                             "referenceId":"NewDimensionTag1",
                             "body":{
                                      "s2cor__Trade_Document_Item__c":"@{NewLineItem1.id}",
                                      "s2cor__Dimension__c":"a0D6F00000hSrqcUAC",
                                      "s2cor__Tag__c":"a146F000005QwdvQAC"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item__c",
                             "referenceId":"NewLineItem2",
                             "body":{
                                      "s2cor__Product__c":"01t6F00000AijXDQAZ",
                                      "s2cor__Trade_Document__c":"@{NewPurchaseInvoice.id}",
                                      "s2cor__Description__c":"GST Rounding",
                                      "s2cor__Unit_Price__c":-0.1,
                                      "s2cor__Tax_Amount__c":0,
                                      "s2cor__Tax_Code__c":"a276F00000NiCmJQAV",
                                      "s2cor__Ledger_Account__c":"a0Y6F00000LZLolUAH"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item_Tag__c",
                             "referenceId":"NewDimensionTag2",
                             "body":{
                                      "s2cor__Trade_Document_Item__c":"@{NewLineItem2.id}",
                                      "s2cor__Dimension__c":"a0D6F00000hSrqcUAC",
                                      "s2cor__Tag__c":"a146F000005R2M8QAK"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item__c",
                             "referenceId":"NewLineItem3",
                             "body":{
                                      "s2cor__Product__c":"01t6F00000AijXDQAZ",
                                      "s2cor__Trade_Document__c":"@{NewPurchaseInvoice.id}",
                                      "s2cor__Description__c":"GST Rounding",
                                      "s2cor__Unit_Price__c":0.1,
                                      "s2cor__Tax_Amount__c":0.01,
                                      "s2cor__Tax_Code__c":"a276F00000NiCmHQAV",
                                      "s2cor__Ledger_Account__c":"a0Y6F00000LZLolUAH"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item_Tag__c",
                             "referenceId":"NewDimensionTag3",
                             "body":{
                                      "s2cor__Trade_Document_Item__c":"@{NewLineItem3.id}",
                                      "s2cor__Dimension__c":"a0D6F00000hSrqcUAC",
                                      "s2cor__Tag__c":"a146F000005R2M8QAK"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item__c",
                             "referenceId":"NewLineItem4",
                             "body":{
                                      "s2cor__Product__c":"01t6F00000AijXDQAZ",
                                      "s2cor__Trade_Document__c":"@{NewPurchaseInvoice.id}",
                                      "s2cor__Description__c":"Group Disc",
                                      "s2cor__Unit_Price__c":-134.47,
                                      "s2cor__Tax_Amount__c":-13.45,
                                      "s2cor__Tax_Code__c":"a276F00000NiCmHQAV",
                                      "s2cor__Ledger_Account__c":"a0Y6F00000LZLolUAH"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item_Tag__c",
                             "referenceId":"NewDimensionTag4",
                             "body":{
                                      "s2cor__Trade_Document_Item__c":"@{NewLineItem4.id}",
                                      "s2cor__Dimension__c":"a0D6F00000hSrqcUAC",
                                      "s2cor__Tag__c":"a146F000005R2M8QAK"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item__c",
                             "referenceId":"NewLineItem5",
                             "body":{
                                      "s2cor__Product__c":"01t6F00000AijXDQAZ",
                                      "s2cor__Trade_Document__c":"@{NewPurchaseInvoice.id}",
                                      "s2cor__Description__c":"Fleet - Comm",
                                      "s2cor__Unit_Price__c":525.47,
                                      "s2cor__Tax_Amount__c":0,
                                      "s2cor__Tax_Code__c":"a276F00000NiCmJQAV",
                                      "s2cor__Ledger_Account__c":"a0Y6F00000LZLoyUAH"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item_Tag__c",
                             "referenceId":"NewDimensionTag5",
                             "body":{
                                      "s2cor__Trade_Document_Item__c":"@{NewLineItem5.id}",
                                      "s2cor__Dimension__c":"a0D6F00000hSrqcUAC",
                                      "s2cor__Tag__c":"a146F000005R2MDQA0"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item__c",
                             "referenceId":"NewLineItem6",
                             "body":{
                                      "s2cor__Product__c":"01t6F00000AijXDQAZ",
                                      "s2cor__Trade_Document__c":"@{NewPurchaseInvoice.id}",
                                      "s2cor__Description__c":"Fleet - Comm",
                                      "s2cor__Unit_Price__c":-83.93,
                                      "s2cor__Tax_Amount__c":-8.39,
                                      "s2cor__Tax_Code__c":"a276F00000NiCmHQAV",
                                      "s2cor__Ledger_Account__c":"a0Y6F00000LZLoyUAH"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item_Tag__c",
                             "referenceId":"NewDimensionTag6",
                             "body":{
                                      "s2cor__Trade_Document_Item__c":"@{NewLineItem6.id}",
                                      "s2cor__Dimension__c":"a0D6F00000hSrqcUAC",
                                      "s2cor__Tag__c":"a146F000005R2MDQA0"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item__c",
                             "referenceId":"NewLineItem7",
                             "body":{
                                      "s2cor__Product__c":"01t6F00000AijXDQAZ",
                                      "s2cor__Trade_Document__c":"@{NewPurchaseInvoice.id}",
                                      "s2cor__Description__c":"Office Lift",
                                      "s2cor__Unit_Price__c":44.54,
                                      "s2cor__Tax_Amount__c":4.45,
                                      "s2cor__Tax_Code__c":"a276F00000NiCmHQAV",
                                      "s2cor__Ledger_Account__c":"a0Y6F00000LZLolUAH"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item_Tag__c",
                             "referenceId":"NewDimensionTag7",
                             "body":{
                                      "s2cor__Trade_Document_Item__c":"@{NewLineItem7.id}",
                                      "s2cor__Dimension__c":"a0D6F00000hSrqcUAC",
                                      "s2cor__Tag__c":"a146F000005R2M8QAK"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item__c",
                             "referenceId":"NewLineItem8",
                             "body":{
                                      "s2cor__Product__c":"01t6F00000AijXDQAZ",
                                      "s2cor__Trade_Document__c":"@{NewPurchaseInvoice.id}",
                                      "s2cor__Description__c":"Totts Fleet",
                                      "s2cor__Unit_Price__c":479.42,
                                      "s2cor__Tax_Amount__c":47.94,
                                      "s2cor__Tax_Code__c":"a276F00000NiCmHQAV",
                                      "s2cor__Ledger_Account__c":"a0Y6F00000LZLoyUAH"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item_Tag__c",
                             "referenceId":"NewDimensionTag8",
                             "body":{
                                      "s2cor__Trade_Document_Item__c":"@{NewLineItem8.id}",
                                      "s2cor__Dimension__c":"a0D6F00000hSrqcUAC",
                                      "s2cor__Tag__c":"a146F000005QwduQAC"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item__c",
                             "referenceId":"NewLineItem9",
                             "body":{
                                      "s2cor__Product__c":"01t6F00000AijXDQAZ",
                                      "s2cor__Trade_Document__c":"@{NewPurchaseInvoice.id}",
                                      "s2cor__Description__c":"Social - BH",
                                      "s2cor__Unit_Price__c":123.14,
                                      "s2cor__Tax_Amount__c":12.31,
                                      "s2cor__Tax_Code__c":"a276F00000NiCmHQAV",
                                      "s2cor__Ledger_Account__c":"a0Y6F00000LZLolUAH"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item_Tag__c",
                             "referenceId":"NewDimensionTag9",
                             "body":{
                                      "s2cor__Trade_Document_Item__c":"@{NewLineItem9.id}",
                                      "s2cor__Dimension__c":"a0D6F00000hSrqcUAC",
                                      "s2cor__Tag__c":"a146F000005TNVBQA4"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item__c",
                             "referenceId":"NewLineItem10",
                             "body":{
                                      "s2cor__Product__c":"01t6F00000AijXDQAZ",
                                      "s2cor__Trade_Document__c":"@{NewPurchaseInvoice.id}",
                                      "s2cor__Description__c":"Fleet - RT",
                                      "s2cor__Unit_Price__c":81.81,
                                      "s2cor__Tax_Amount__c":8.18,
                                      "s2cor__Tax_Code__c":"a276F00000NiCmHQAV",
                                      "s2cor__Ledger_Account__c":"a0Y6F00000LZLolUAH"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item_Tag__c",
                             "referenceId":"NewDimensionTag10",
                             "body":{
                                      "s2cor__Trade_Document_Item__c":"@{NewLineItem10.id}",
                                      "s2cor__Dimension__c":"a0D6F00000hSrqcUAC",
                                      "s2cor__Tag__c":"a146F000005R2MDQA0"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item__c",
                             "referenceId":"NewLineItem11",
                             "body":{
                                      "s2cor__Product__c":"01t6F00000AijXDQAZ",
                                      "s2cor__Trade_Document__c":"@{NewPurchaseInvoice.id}",
                                      "s2cor__Description__c":"Contact - AH",
                                      "s2cor__Unit_Price__c":86.78,
                                      "s2cor__Tax_Amount__c":8.68,
                                      "s2cor__Tax_Code__c":"a276F00000NiCmHQAV",
                                      "s2cor__Ledger_Account__c":"a0Y6F00000LZLolUAH"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item_Tag__c",
                             "referenceId":"NewDimensionTag11",
                             "body":{
                                      "s2cor__Trade_Document_Item__c":"@{NewLineItem11.id}",
                                      "s2cor__Dimension__c":"a0D6F00000hSrqcUAC",
                                      "s2cor__Tag__c":"a146F000005QwdwQAC"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item__c",
                             "referenceId":"NewLineItem12",
                             "body":{
                                      "s2cor__Product__c":"01t6F00000AijXDQAZ",
                                      "s2cor__Trade_Document__c":"@{NewPurchaseInvoice.id}",
                                      "s2cor__Description__c":"People - FW",
                                      "s2cor__Unit_Price__c":95.44,
                                      "s2cor__Tax_Amount__c":9.54,
                                      "s2cor__Tax_Code__c":"a276F00000NiCmHQAV",
                                      "s2cor__Ledger_Account__c":"a0Y6F00000LZLolUAH"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item_Tag__c",
                             "referenceId":"NewDimensionTag12",
                             "body":{
                                      "s2cor__Trade_Document_Item__c":"@{NewLineItem12.id}",
                                      "s2cor__Dimension__c":"a0D6F00000hSrqcUAC",
                                      "s2cor__Tag__c":"a146F000005QwdrQAC"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item__c",
                             "referenceId":"NewLineItem13",
                             "body":{
                                      "s2cor__Product__c":"01t6F00000AijXDQAZ",
                                      "s2cor__Trade_Document__c":"@{NewPurchaseInvoice.id}",
                                      "s2cor__Description__c":"Execitives - PE\/TO\/KG",
                                      "s2cor__Unit_Price__c":757.46,
                                      "s2cor__Tax_Amount__c":75.75,
                                      "s2cor__Tax_Code__c":"a276F00000NiCmHQAV",
                                      "s2cor__Ledger_Account__c":"a0Y6F00000LZLolUAH"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item_Tag__c",
                             "referenceId":"NewDimensionTag13",
                             "body":{
                                      "s2cor__Trade_Document_Item__c":"@{NewLineItem13.id}",
                                      "s2cor__Dimension__c":"a0D6F00000hSrqcUAC",
                                      "s2cor__Tag__c":"a146F000005QwdtQAC"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item__c",
                             "referenceId":"NewLineItem14",
                             "body":{
                                      "s2cor__Product__c":"01t6F00000AijXDQAZ",
                                      "s2cor__Trade_Document__c":"@{NewPurchaseInvoice.id}",
                                      "s2cor__Description__c":"Totts Admin",
                                      "s2cor__Unit_Price__c":169.94,
                                      "s2cor__Tax_Amount__c":16.99,
                                      "s2cor__Tax_Code__c":"a276F00000NiCmHQAV",
                                      "s2cor__Ledger_Account__c":"a0Y6F00000LZLolUAH"
                                    }
                           },
                           {
                             "method":"POST",
                             "url":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Item_Tag__c",
                             "referenceId":"NewDimensionTag14",
                             "body":{
                                      "s2cor__Trade_Document_Item__c":"@{NewLineItem14.id}",
                                      "s2cor__Dimension__c":"a0D6F00000hSrqcUAC",
                                      "s2cor__Tag__c":"a146F000005QwduQAC"
                                    }
                           }
                         ]
    }

  • I have tried splitting this by first posting to

    s2cor__Sage_INV_Trade_Document__c
    and 

    s2cor__Sage_INV_Trade_Document_Tag__c

    I set the referenceid on the former = SSTEST1909242609561

    I then tried posting to s2cor__Sage_INV_Trade_Document_Item__c endpoint, I set the  "s2cor__Trade_Document__c" (value to the reference id from my first post..

    the error message I got on this attempt was;

    Could not find the referenced operation SSTEST1909242609561

  • Hi.
    As your first complete request has 30 POST actions, this will hit salesforce limit. Splitting the this request up could be the solution.

    The reason it can't find the referenced operation SSTEST1909242609561 is that you are sending 2 independent requests. The 2nd item request cannot reference @{SSTEST1909242609561.Id}. You would need to have the actual Trade Document Id in there that the first POST created.

  • Thanks. Where can I get the actual trade document id from?

    Is it a value retuned in the response? (below)

    Or do I have to perform a get first to see this?

    {
    "compositeResponse":[
    {
    "body":{
    "id":"a1x6F00000896QAQAY",
    "success":true,
    "errors":[ ]
    },
    "httpHeaders":{
    "Location":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document__c\/a1x6F00000896QAQAY"
    },
    "httpStatusCode":201,
    "referenceId":"SSTEST1909242609561"
    },
    {
    "body":{
    "id":"a1u6F000005xxckQAA",
    "success":true,
    "errors":[ ]
    },
    "httpHeaders":{
    "Location":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document_Tag__c\/a1u6F000005xxckQAA"
    },
    "httpStatusCode":201,
    "referenceId":"NewPurchaseInvoiceTag"
    }
    ]
    }

  • Looking at the response you have attached;

    "id":"a1x6F00000896QAQAY" or "Location":"\/services\/data\/v44.0\/sobjects\/s2cor__Sage_INV_Trade_Document__c\/a1x6F00000896QAQAY"