Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMurilo de Melo
14,456 PointsFor a pay service application do I need to an API to access data or another approach is used? And how?
Hi
We've seen examples where we retrieve JSON from a third API stored in a server. But if I build a program for clients to access data do I do it with (restricted) APIs too? How do I create JSON formats to store on a server and make use of it using fetch?
tnx
1 Answer
Mark Westerweel
Full Stack JavaScript Techdegree Graduate 22,378 Pointswrite your API as a JSON--kinda like an object of key value pairs. Do keep in mind they have to be written as strings, so not like a regular JavaScript object (like the one we used in the 2nd project of the FullStack Course).
Then host it via netlify or any other way.
For restricted API's you would want to make use of the "init" parameter(2nd).
You could work with credentials or API tokens. This is also done to prevent clients requesting too much data.
Here is some addtional info on creating API's