(07-19-2022, 04:28 PM)rlebeau Wrote:(07-19-2022, 03:21 PM)GeorgeBairaktaris Wrote: Is there anyone that have worked with wordpress and woocommerce rest api?
Why? Are you having a problem with them? What are you trying to do exactly that is not working for you? What does your code look like?
I have problem with authentication.
Everything I am trying I am getting 401 error.
"HTTP/1.1 401 Unauthorized"
Last attempt I tried was from the Postman call like this:
Code:
idHttp.Request.UserAgent := 'Mozilla/5.0 (Windows NT x.y; rv:10.0) Gecko/20100101 Firefox/10.0';
try
idhttp.Request.CustomHeaders.AddValue('Cookie', 'PHPSESSID=c4ec7f957fe429e2f8ca2cc6a641469f');
idhttp.Get('http://charalampidis.globaltouchdev.eu/wp-json/wc/v2/orders?' +
'oauth_consumer_key=ck_399bad935831bff0bc342e8edd3f47a14f1fa63b&' +
'oauth_signature_method=HMAC-SHA1&' +
'oauth_timestamp=1658245863&' +
'oauth_nonce=Pi0PZa1qirl&' +
'oauth_version=1.0&' +
'oauth_signature=CW1up7Z6NQDGdQgXgcj9vLZm9HE%3D');
Memo1.Lines.Add(IntToStr(IdHTTP.ResponseCode));
Memo1.Lines.Add(IdHTTP.ResponseText);
except
Memo1.Text := idhttp.ResponseText;
end;
In Postman I use Consumer Key and Consumer Secret with 0auth1 and its working.
Any help is appreciated.
Thank you.