How to get information of a other glitch project?


#1

Hey there,

I think the title is a bit strange, but I will explain…

I have a project on glitch, let’s name it project #1 for now… Okay, than I have a other project, which we will name project#2 for now. Okay, so at project#1 there is information I want to show to a system in project#2.

My question: How to do that?


#2

Hi @Rienknr1!

How you accomplish this depends on what sort of information you want to show and how your projects are organized.

Let’s say for example you’ve got a discord bot at project1.glitch.me and you want to use the number of servers that bot’s joined in project2.glitch.me. You could use a framework like Express to provide an API to your bot’s data and expose a route at https://project1.glitch.me/servers that returns the server count, and then use that data in project2.glitch.me by requesting the information from https://project1.glitch.me/servers. https://glitch.com/edit/#!/rest-api?path=routes.js:74:2 is an example of this kind of thing (it’s not a discord bot, but demonstrates the concept of an API).

Is that the kind of thing you’re looking for, or are you looking for something else completely?


#3

I will look if it works, I will let you know asap.

~Rienknr1


#4

I am not really good in working with API’s and that kind of stuff… So I think I need to leave it here till I have more experience with the API coding…


#5

If you want to share your project name or some code snippets I’m happy to take a look and give you some more specific guidance, or someone else can weigh in. Is that the sort of data you’re looking to access (i.e. something that project1 knows)?