-3

I wanna use this API https://the-one-api.dev/documentation in my java project, to put it into json file and then show as objects in the app. But the problem is: I can't get/do not know the key and value pairs, as I understand for this I should use my API key in the URL, so that I can see the json in the browser, but nothing works. What is the right way of using API in the URL, or how can I get/discover these key and value pairs?

I tried https://the-one-api.dev/v2/?apikey=76OYB2YXYZkc5dpVZdY5/character but it says Endpoint does not exist.

https://the-one-api.dev/v2?apikey=76OYB2YXYZkc5dpVZdY5&character but it says Endpoint does not exist.

https://the-one-api.dev/v2/character/?apikey=76OYB2YXYZkc5dpVZdY5 says {"success":false,"message":"Unauthorized."}

1 Answers1

2

From the documentation:

You need to send the access key as a bearer token in every request you make to the api. Bearer tokens must be included in the authorization header

It seems that you can not send your API key in the URL query string but must put it in the authorization header.

The code from this answer may help you.

CeruleanW
  • 114
  • 1
  • 3
  • it's 100% right, i took it from their website, here I copied it from the website - 76OYB2YXYZkc5dpVZdY5 as you see it's the same. It seems like I just do not know in what order I should right this url – Billy Milligan Dec 11 '20 at 01:06
  • Guess you are right. It seems like you cannot add it to the URL. – CeruleanW Dec 11 '20 at 01:21
  • @BillyMilligan - Are you familiar with [HTTP headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers)? Also [this](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization). These are not part of the URL. This is what Fongee is [referring to](https://the-one-api.dev/documentation#3), I believe. – andrewJames Dec 11 '20 at 01:37