Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create the signature if I am sending a normal post request? #31

Open
bishkou opened this issue Nov 9, 2022 · 0 comments
Open

Comments

@bishkou
Copy link

bishkou commented Nov 9, 2022

Hi so basically I am using apple new API for analytics, so I need to send a post request to the api to create a report, the closest thing I found on the internet to my task is the create article function you have. but I am failing miserably to create the right signature.

I have succeeded in making it work with python but it didn't work in Javascript. I think I am failing at creating the right canonical_request.

here is the python line for creating the canonical_request:
canonical_request = method + url + date + content_type + json.dumps(payload)

whereas;
content_type = "application/json"
payload = {"data":{"reportType":"ARTICLE_DETAIL", "startDate":"2022-11-07", "timezone":"-0000"}}

I tried copying your method by doing this:
let canonicalRequest = Buffer(method + host + endpoint + date + content_type + JSON.stringify(payload) , 'ascii')

but unfortunately didn’t work.

Would love to know if you have any input on this or if you can help me solve this problem.

Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant