+ Start a Discussion
Piyush NandrekarPiyush Nandrekar 

How to call custom REST API from composite API - subrequest

Hi,

I have created a custom api -
url mapping -> urlMapping='/api/customObjectName/*'

I can call this API and get result when i call it from POSTMAN as a SEPARATE request , however when i am calling this API as a "Subrequest" of Composite API from postman , i am getting below error :
services/apexrest/api/myCustomObject/a1E180000015rw5XXX' is not a valid url.

my composite API request is as below :
URL : https://xyz.salesforce.com/services/data/v44.0/composite
HTTP Method : POST
Body : 
{
  "allOrNone": true,
  "compositeRequest": [
    {
      "method": "GET",
      "url": "/services/data/v44.0/sobjects/Order/80118000000LUCmXXX",
      "referenceId": "OrderRef"
    }, 
    
  
    {
      "method": "GET",
      "url": "services/apexrest/api/myCustomObject/a1E180000015rw5XXX",
      "referenceId": "customObjRef"
        
    }
   
  ]
}


Response :
{
            "body": [
                {
                    "errorCode": "PROCESSING_HALTED",
                    "message": "'services/apexrest/api/myCustomObject/a1E180000015rw5XXX' is not a valid url"
                }
            ],
            "httpHeaders": {},
            "httpStatusCode": 400,
            "referenceId": "customObjRef"
        }
 
Will FawcettWill Fawcett
Did you ever get an answer on this? I am running into the same issue.