I have a wierd problem: I'm calling SAP from salesforce apex and I have trouble with one of my request.
This one is working.
request.setEndpoint(authentification_details.Webservice_enpoint__c+'/v1/product/ProductMasterSet(product=\''+productCode+ '\')?$format=json');
But the next one is not working
request.setEndpoint(authentification_details.Webservice_enpoint__c+'/v1/product/ProductsSet?$filter=Productdescription eq \'XXXXXX\' and Language eq \'EN\'');
(XXXX is just a product code). I got a 400 code and the call never reach the SAP side. I played around a bit and think i figured out that the '$' sign is possibly responsible for the error, because when i test in postman this is working.
EDIT: it was the spaces responsible for the errors (see answer below)
I did try encoding the $ sign using exa (%24) and unicode ($) Exa is not reaching SAP either but unicode is but is not interpreted correctly on SAP Side.
Does anyone has had this problem before? is there a way to force the encoding of my request so it's like postman?
Thanks in advance
%20
or using+
signs instead since spaces in URLs can be problematic. It could also be the single quotes (Apex has to handle the string with escaped characters first before it's ferried off to the HTTP service which can then re-encode) but you already have a working example with single quotes.