API to JSON... New to Glitch I need some help to start

#1

Hey everyone,

Please tell me this is a great community and I will get some help :wink:

I’m really sorry i’m not a real programmer but I’m trying to learn more every day and glitch seems to be a good way to go for me, but I need some guiding.

First what I want to accomplish, I’m currently using an API to pull some information and use this information in an app.

The people running the API changes the structure from time to time so I might have to update my app, but the way my app is made it’s not cool for my user to redownload it just because of a small change in the API.

What I’d love to do is to take the information I get from the API and send it myself to my app, so if there is any changes to the API I can just change it straight on glitch and pass on my own JSON reply to my app, so even if there is any changes I can just make change in 1 place and users wouldn’t even see the difference…

My biggest problem, is that I don’t know how to search on the internet to find information about all this… I don’t yet have the vocabulary so google is not my friend because I can’t find proper word to describe what I want to do lol…

PLEASE HELP ME :slight_smile:

So basically from an API server I get and JSON reply… I would love to reformat that JSON reply with my own API Server and feed that information to my user so my “app” always get the same information regardless of changes on the first API server…

I hope I was able to make this clear XD…

I don’t need someone to tell me how to do all that… but if there is documentation or videos that can guide me through all this that would be awesome!!! :smiley:

Thanks in advance

0 Likes

#2

If you don’t update to the newer version of the API you wouldn’t have that problem. But if they add any extra features that you might like you do need to update.

0 Likes

#3

All you want to do is release a api endpoint from your glitch project (using express or anything else).

in the backend processing of that endpoint you would simply call the original api endpoint and make object according to what you want.
and then just send the object response in your project api response.

but a problem with all this is you will need to kepp your glitch project constantly running (can be easily achieved with uptime robot)
& you only have 4000 calls/hour; which is not sufficient if your app runs on large scale…

i hope you got what i meant. if you need help durther I am right here.

0 Likes

#4

Hi Froosty,

Thanks for your answer, I kinda got what you meant!!

Thanks for our answer…

I was able to run locally a way to pass the API response to my own “Server” and send the response to a browser.

I’m using Node > Express > Node-Fetch for now (that’s the easiest way I found so far).

The next thing I’m trying to do is to manipulate the response that comes to me to modify it in a way I can use it for my own app. Unfortunately I’m stuck here…

I get the JSON but I can’t find the way to change the data, do I have to make it as an array so I can edit it? I tried length to at least create an IF but it says it’s not define or something…

So what I have so far… My Express is running I can call the API get the Response and pass the response back to my browser. IT’s the middle part that I can’t do anything modify the data

0 Likes

#5

According to what you said, seems like you are stuck on modifying json data itself… so I suggest you to look few tutorials about json modification :wink:

0 Likes

#6

I’m just an idiot not thinking out of the box LOL

5 Minutes after I wrote my message, I figured out how to do it :wink:

I need to extract the data I need into an Array and just then serve that Array in a Silver Platter :wink:

2 Likes