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
SUDEEP SINGHSUDEEP SINGH 

i have already passed the Consumer Secret in Header and same Consumer Secret is working in URL but in Developer console i am getting Below Error :

Hello Everone.

I am trying to use my woocommerce rest api to access my product and but i am getting some error.

i am using the same Consumer_key and Consumer_Secret key in both  url and in developer console. i am able to execute URL IN MY BROWSER BUT IN DEVELOPER CONSOLE I AM HETTING ERROR.


HttpRequest req = new HttpRequest();
Http http= new Http();
req.setMethod('GET'); r
eq.setEndpoint('https://www.quoteshark.net/wc-api/v3/products /categories'); r
eq.setHeader('Content-Type','text/JSON;charset=UTF-8');
req.setHeader('Consumer_key','ck_a8d6d6433448838c7c5bd824bffa7b47769c178e'); req.setHeader('Consumer_Secret','cs_2e258b878c0b7ed4ccaeb17a66e53f36f037d08c');
HttpResponse res = http.send(req);
String JSON = res.getBody(); System.debug('GotJSON '+JSON);
System.debug('Got '+String.valueof(res));


i have already passed the Consumer Secret in Header and same Consumer Secret is working in URL but in Developer console i am getting Below

Error :
{"errors":[{"code":"woocommerce_api_authentication_error","message":"Consumer Secret is invalid"}]}



Thanks & regards
Sudeep Singh
Vivek DVivek D
Check the URL in debug log might be some charaters are changed because of auto url encoding. If that is the problem encode the URL by yourself using URL encoding method of Salesforce.