0

I'm trying to retrive some data from apptopia but I'm finding it pretty tricky (due to my lack of experience). In their authentication page: https://dev.apptopia.com/#authentication there are some instructions, but I just can't make it work.

I need a client and a secret (these bellow are not mine but the ones on the company's site)

client: JFqXPDhiLuvY
secret: L2nerprCksacBoFzUqtfHz8v

And I must use those information in order to obtain a Session token via HTTPS POST request:

curl -X "POST" "https://integrations.apptopia.com/api/login" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode "client=<client>" \
  --data-urlencode "secret=<secret>"

I just don't know how to do it. I tried using the answen on this post: Python Request Post with param data but it didn't work. Could someone help me please? Thanks!

Marcos Dias
  • 420
  • 3
  • 9
  • 1
    “*It doesn’t work*” isn’t particularly helpful. What error messages are you seeing? What is the expected behavior of the code you’ve written here, and what did you observe it do in actuality? [ask] – esqew Sep 22 '21 at 18:13
  • I'm really sorry about that, I should have added more details. I get a error. The expected behavior should be a JSON token, as can be seen here: https://dev.apptopia.com/#authentication – Marcos Dias Sep 22 '21 at 18:23

1 Answers1

1

Did you try passing credentials as data in your request?

import requests

headers = {
    'Content-Type': 'application/x-www-form-urlencoded',
}

data = {
    'client':your_client,
    'secret':your_secret'
}

response = requests.post('https://integrations.apptopia.com/api/login', headers=headers, data=data)
Cassiopea
  • 255
  • 7
  • 16