Forum Discussion
I just tried removing those headers but had no luck.
I have not personally encoded any of the keys or tokens except for the x-myobapi-cftoken containing the credentials which is b64 encoded. I'm not sure if the python requests module automatically applies and encoding scheme but I haven't run into any issues with that when requesting other APIs.
An example request that I've been using is:
GET: https://ar1.api.myob.com/accountright/{{company_file_id}}/Sale/Invoice/Service
Asking the obvious: have you actually got permission to login to the file online using the user credentials you are sending??
install Fiddler and capture your request and see what is getting sent exactly. Your example is your call from your code. Capture the actual request and examine that. From there you can start to see what is going wrong. My example is capture from Fiddler and shows a successful call
6magics
Here is a call from RestSharp .NET library which is just a lib around a httpclient to simplify calls to API
GET https://api.myob.com/accountright//f173ad4{TRUNCATED}aaa/Sale/Invoice HTTP/1.1 authorization: Bearer AA{TRUNCATED}3TWg-WJ x-myobapi-cftoken: QWRt{TRUNCATED}Wjgj x-myobapi-key: xd{TRUNCATED}ye x-myobapi-version: v2 Accept: application/json, text/json, text/x-json, text/javascript, application/xml, text/xml User-Agent: RestSharp/108.0.2.0 Host: api.myob.com Accept-Encoding: gzip
I am Base64Encoding the cftToken
Looking for something else?
Search the Community Forum for answers or find your topic and get the conversation started!
Find technical support and help for all MYOB products in our online help centre
Dig into MYOB Academy for free courses, learning paths and live events to help build your business with MYOB.