API Entry in MongoDB not showing up

Hi all, I’ve been trying to follow the instructions to set up a Tyk environment on a Vagrant machine, and I’ve gotten everything to work. After adding an entry to the API’s using the Dashboard, I see the entry update in Mongodb. However if I halt the machine and re-up it the API disappears from the Dashboard, despite the entry still being in Mongodb.

Is there a reason why the Dashboard isn’t recognizing the API?

Also is there any way to manually insert API’s past making a .JSON file in /opt/tyk-gateway/apps ? I haven’t had any success with API’s appearing on the dashboard through custom files.

It can be that you run dashboard bootstrap script multiple times and generated another organization, which do not have access to this API. Check organizations collection and org_id field of the API definition, to check if they match.

Regarding files, you can’t use both dashboard and file-based storage.

Cheers.

Ahh I see, thanks! The organization id’s were indeed different.

Also, if I wanted to automate entering an API entry, would I have to use the RESTFUL API to remotely post the API I want to insert into Mongo? Or if I insert manually into the MongoDB will it automatically update the dashboard?

Everything you can do via the dashboard, you can also do via an api call.

https://tyk.io/docs/tyk-dashboard-api/

Hm, I’ve tried setting up API calls to list all API’s that the dashboard currently has.

It is currently a GET request that tries to hit http://:3000/api/apis.

When I make the request however, it returns a “Not Authorized” error. I’ve tried using the secret in tyk_analytics.conf, creating a token/key for the default user, and using the default users token found in Dashboard.

What am I missing in order to get the Tyk authorization to accept the API request?