0

I am using Composite API to get the opportunity record but facing 302 error

{
 "compositeRequest" : [
    {
        "method" : "GET",
        "url" : "/services/data/v42.0/query/?q=select+id,Opportunity_No__c+from+Opporunity+where+Opportunity_No__c='OP-0000014'",
        "referenceId" : "refOpporrunityInfo"                               
    }]
}

URL: https://vei-dev-ed.lightning.force.com/services/data/v42.0/composite

Method: POST

Header:

  • Authorization: Bearer token

  • Content-Type: application/json

Can anyone help me on this.

Thanks in advance

Regards, Lavanya

1
  • 302 is not an error, it's an informative message redirecting the client to a different URL. This happens when you use the wrong URL. This is true for any API call in Salesforce when you use the wrong URL.
    – sfdcfox
    Apr 4, 2019 at 13:45

2 Answers 2

2

Change the instance url of your org https://vei-dev-ed.my.salesforce.com/services/data/v42.0/composite

URL: https://vei-dev-ed.my.salesforce.com/services/data/v42.0/composite Method: POST Header: Authorization: Bearer {token} Content-Type: application/json

{
 "compositeRequest" : [
    {
        "method" : "GET",
        "url" : "/services/data/v42.0/query/?q=select+id,Opportunity_No__c+from+Opportunity+where+Opportunity_No__c='OP-0000014'",
        "referenceId" : "refOpporrunityInfo"                               
    }]
}

Now it's working please refer below link

https://success.salesforce.com/answers?feedtype=RECENT&criteria=BESTANSWERS#!/feedtype=MINE

Thanks,

Lavanya

0

There is a typo in the table name after "FROM" (Opporunity)

Try with the following request:

{
 "compositeRequest" : [
    {
        "method" : "GET",
        "url" : "/services/data/v42.0/query/?q=select+id,Opportunity_No__c+from+Opportunity+where+Opportunity_No__c='OP-0000014'",
        "referenceId" : "refOpporrunityInfo"                               
    }]
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .