-1

I would like to try to get data from this api

I followed the previous post but it does not return any data to me. My code look like this.

import requests

url = "https://api.makcorps.com/free/bali/search?key=JWT eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1MTc2NzczNjAsImlkZW50aXR5IjozLCJuYmYiOjE1MTc2NzczNjAsImV4cCI6MTUxNzY3OTE2MH0.ytSqQj3VDymEaJz9EIdskWELwDQZRD1Dbo6TuHaPz9U"
data = requests.get(url).json 

I'm a newbie to working with APIs, may i have your suggestions what went wrong?

DapperDuck
  • 2,460
  • 1
  • 7
  • 20

1 Answers1

0

You must send the JWT token in an HTTP header, not as part of the querystring. Also .json() is a method, you should call it by appending parentheses:

import requests

url = "https://api.makcorps.com/free/bali"
headers = {"Authorization": "JWT <Your JWT Token>"}

print(requests.get(url, headers=headers).json())
Selcuk
  • 52,758
  • 11
  • 94
  • 99