+ 1

API's?

Ok, so this guy wants me to make a Javascript program that lists out all of his costumers devices. He uses atera but I have absolutely no idea where to start and I have no idea how to use an api. I have the api key and the apidocs give me a bunch of information that I have absolutely no idea what to do with. It says things like "curl" and "response headers" and a bunch of things that I'm really not familiar with. However, this is something I want to learn. It's not really a thing we NEED to do, but it would be helpful to his buisness AND help me learn more about the subject. I'll provide any information that would help you help me.

9th Sep 2018, 11:35 PM
Daniel Cooper
Daniel Cooper - avatar
4 Respostas
+ 5
Ok I would recommend that you start with getting a succesfull response (get status of 200 and see the requested data) Start with this tutorial to use Postman http://toolsqa.com/postman-tutorial/ Download it, read a bit about how to make GET requests And also read about Basic Authentication
10th Sep 2018, 12:43 AM
Burey
Burey - avatar
+ 3
Front end javascript is not the good way to access api because it would expose your api key, and you also would encounter CORS issues. Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources on a web page to be requested from another domain outside the domain from which the first resource was served. Use Node.js to access the api data on server side and inject the codes to front end using ejs.
10th Sep 2018, 1:02 AM
Calviղ
Calviղ - avatar
0
That is the exact things I was looking at. But I have no idea how to use any of the information provided. How exactly would I get all of the device names and display them? How do I even get the json(I assume that's what i'm trying to do)? I literally know nothing about using an api. I saw a youtube video on it, and he managed to get a json in the web browser. But when I try, it says "This XML file does not appear to have any style information associated with it. The document tree is shown below." Shown with this "No HTTP resource was found that matches the request URI 'https://app.atera.com/api/v3/agents&appid="MyKeyHere""(Am I even doing this right?) And this "No type was found that matches the controller named 'v3'." TLDR I have no idea what i'm doing with the information provided xD
10th Sep 2018, 12:19 AM
Daniel Cooper
Daniel Cooper - avatar