You need to sign in to do that
Don't have an account?
Piyush 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"
}
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"
}
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 !!