-
Notifications
You must be signed in to change notification settings - Fork 6
API Documentation
Listed below are the base URLs that you will need to hit to access the rails API. Note that if you are attempting to access the local development URLs from outside of the Virtual Machine, you will need to edit your /etc/hosts as shown in these instructions on the Plattr documentation.
Note also for the local environment that requests from the host machine to the VM may require a port other than 8080 if Vagrant autocorrected a collision when bringing up your box. Requests from inside the VM to the Rails API should always be directed to port 8080, as this is the only port on which the VirtualHost is listening.
- local development (plattr): rails_api.localhost:8080
- staging: rails_api.tapasdev.neu.edu
Every request to the API requires authentication. This means that two things need to be the case:
The Authorization header in your request should be set to pass a valid api token associated with a (the) user. This should look like this (mechanisms for setting this will vary by language/framework): Authorization: Token token=a47a8e54b11c4de5a4a351734c80a14a
. Obviously the literal token will be different.
This should be handled locally by the provisioning script and on our servers by the deployment scripts, but if requests are failing to authenticate you should access the Rails console and confirm that the user you are trying to authenticate as exists in the database and has the expected api key.
If it turns out that the user does not exist, you can run the thor tapas_rails:create_api_user
command from the root of the rails app to create them. If you are unsure of the api key that the resulting user will have, consult config/tapas_api.yml
for further information.