You need to sign in to do that
Don't have an account?
Karthik j
Httpget Annotated method not returning records in inbound callout.
I am making an inbound callout to my salesforce org by adding Id as a parameter to the endpoint and below is my apex code.
@RestResource(urlMapping='/Product/')
global class IntegrationProductsApi {
@httpget
global static List<Product2> getProducts(){
Map<String,string> reqParams = RestContext.request.params;
string prodId = reqParams.get('Id');
system.debug('prodId>'+prodId);
List<Product2> productList=[select Id,ProductCode,Name from Product2 where Id=:prodId];
system.debug('productList>'+productList);
if(productList.size()>0){
return productList;
}
return null;
}
}
Id which I am passing with endpoint is already there in salesforce DB, but still in the above debug statement I am getting productList as null.
I am new to integration and any help would be appreciated.
@RestResource(urlMapping='/Product/')
global class IntegrationProductsApi {
@httpget
global static List<Product2> getProducts(){
Map<String,string> reqParams = RestContext.request.params;
string prodId = reqParams.get('Id');
system.debug('prodId>'+prodId);
List<Product2> productList=[select Id,ProductCode,Name from Product2 where Id=:prodId];
system.debug('productList>'+productList);
if(productList.size()>0){
return productList;
}
return null;
}
}
Id which I am passing with endpoint is already there in salesforce DB, but still in the above debug statement I am getting productList as null.
I am new to integration and any help would be appreciated.
have you queried the data out of this class, maybe in the SOQL query editor of the developer console to check you have the data for that Id?