0

I'm trying to receive a POST call with multiple records of a custom object. I don't know if that's the best choice but i'm using /services/data/v47.0/composite/tree/CSVEnergyLead__c/

When i try to do a post from workbench i'm always receiving same errors:

400 Bad request


{
  "hasErrors" : true,
  "results" : [ {
    "referenceId" : "Ref1",
    "errors" : [ {
      "statusCode" : "INVALID_INPUT",
      "message" : "Invalid entity type provided in the request.",
      "fields" : [ ]
    } ]
  }, {
    "referenceId" : "Ref2",
    "errors" : [ {
      "statusCode" : "INVALID_INPUT",
      "message" : "Invalid entity type provided in the request.",
      "fields" : [ ]
    } ]
  }, {
    "referenceId" : "Ref3",
    "errors" : [ {
      "statusCode" : "INVALID_INPUT",
      "message" : "Invalid entity type provided in the request.",
      "fields" : [ ]
    } ]
  }, {
    "referenceId" : "Ref4",
    "errors" : [ {
      "statusCode" : "INVALID_INPUT",
      "message" : "Invalid entity type provided in the request.",
      "fields" : [ ]
    } ]
  } ]
}

The POST JSON is defined as follows:

{
    "records": [{
        "attributes": {
            "type": "CSVEnergyLead__c ",
            "referenceId": "Ref1"
        },
        "CallDuration__c": null,
        "CallId__c": null,
        "ClosingDate__c": "2018-11-19",
        "CUPS1__c": "ES0021000007700837DC1F",
        "CUPS2__c": "ES0222120070014189CT",
        "ErrorLog__c": "Error en inserción por causas desconcidas",
        "Lead__c": "a3358000001iLVaAAM",
        "Lead_Fotofactura_Id__c": "a3358000001hTQmAAM",
        "LegibleBill__c": false,
        "Phone__c": null,
        "ProcessId__c": "7075800006sGNHpAAO",
        "ProcessStatus__c": "Cargado",
        "RejectionReason__c": "13_AGENDADO",
        "RPSClosing__c": false,
        "SellingAgency__c": "0015800001JLofOAAT",
        "SellingAgent__c": null,
        "SellingTime__c": "9:00:00.000Z",
        "Stage__c": "En gestión",
        "SupplierE__c": "IBERDROLA",
        "SupplierG__c": "IBERDROLA"
    }, {
        "attributes": {
            "type": "CSVEnergyLead__c ",
            "referenceId": "Ref2"
        },
        "CallDuration__c": null,
        "CallId__c": null,
        "ClosingDate__c": "2018-11-19",
        "CUPS1__c": "ES0021000007700837DC1F",
        "CUPS2__c": "ES0222120070014189CT",
        "ErrorLog__c": "",
        "Lead__c": "a334I000001wOqJQAU",
        "Lead_Fotofactura_Id__c": "a3358000001hTQmAAM",
        "LegibleBill__c": false,
        "Phone__c": null,
        "ProcessId__c": "7075800006sGNHpAAO",
        "ProcessStatus__c": "Cargado",
        "RejectionReason__c": "13_AGENDADO",
        "RPSClosing__c": false,
        "SellingAgency__c": "0015800001JLofOAAT",
        "SellingAgent__c": null,
        "SellingTime__c": "9:00:00.000Z",
        "Stage__c": "En gestión",
        "SupplierE__c": "IBERDROLA",
        "SupplierG__c": "IBERDROLA"
    }, {
        "attributes": {
            "type": "CSVEnergyLead__c ",
            "referenceId": "Ref3"
        },
        "CallDuration__c": null,
        "CallId__c": null,
        "ClosingDate__c": "2018-11-19",
        "CUPS1__c": "ES0021000007700837DC1F",
        "CUPS2__c": "ES0222120070014189CT",
        "ErrorLog__c": "",
        "Lead__c": "a3358000001hToUAAU",
        "Lead_Fotofactura_Id__c": "a3358000001hTQmAAM",
        "LegibleBill__c": false,
        "Phone__c": null,
        "ProcessId__c": "7075800006sGNHpAAO",
        "ProcessStatus__c": "Cargado",
        "RejectionReason__c": "13_AGENDADO",
        "RPSClosing__c": false,
        "SellingAgency__c": "0015800001JLofOAAT",
        "SellingAgent__c": null,
        "SellingTime__c": "9:00:00.000Z",
        "Stage__c": "En gestión",
        "SupplierE__c": "IBERDROLA",
        "SupplierG__c": "IBERDROLA"
    }, {
        "attributes": {
            "type": "CSVEnergyLead__c ",
            "referenceId": "Ref4"
        },
        "CallDuration__c": null,
        "CallId__c": null,
        "ClosingDate__c": "2018-11-19",
        "CUPS1__c": "ES0021000007700837DC1F",
        "CUPS2__c": "ES0222120070014189CT",
        "ErrorLog__c": "",
        "Lead__c": "a3358000001hTQmAAM",
        "Lead_Fotofactura_Id__c": "a3358000001hTQmAAM",
        "LegibleBill__c": false,
        "Phone__c": null,
        "ProcessId__c": "7075800006sGNHpAAO",
        "ProcessStatus__c": "Cargado",
        "RejectionReason__c": "13_AGENDADO",
        "RPSClosing__c": false,
        "SellingAgency__c": "0015800001JLofOAAT",
        "SellingAgent__c": null,
        "SellingTime__c": "9:00:00.000Z",
        "Stage__c": "En gestión",
        "SupplierE__c": "IBERDROLA",
        "SupplierG__c": "IBERDROLA"
    }]
}

So the question is, i'm getting that error because of the defined JSON, because of any value that is not expected (example boolean as a string) or there is simply a better way to do that?

The goal is that the process emulates the allOrNone = false. I'm not using a custom web service.

0

Fixed. The problem was the space in "type": "CSVEnergyLead__c ". Thanks anyway.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.