function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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. 
Pradeep BarlaPradeep Barla
I checked the services offered by Composite API inside Workbench using '/services/data/v50.0/composite/ ' , all I could see is 

tree: /services/data/v50.0/composite/tree
batch: /services/data/v50.0/composite/batch
sobjects: /services/data/v50.0/composite/sobjects
graph: /services/data/v50.0/composite/graph

There is no provision for calling Custom Apex Rest URI via Composite API as of WI21.

Also tried hitting combination of different URI paths.

No Luck !!