This repository contains the source code of Card Mine web API.
It works as a card factory engine that helps you generate different kinds of cards along with stamps of formatted text, then persist them in the cloud.
It's essentially implemented to be the back-end to my capstone project for Udacity iOS nanodegree.
The following table summarizes the various API endpoints.
path | method | purpose |
---|---|---|
/api/v1/auth | POST | Email registration. Requires email, password, and password_confirmation params. A verification email will be sent to the email address provided. |
/api/v1/auth | DELETE | Account deletion. This route will destroy users identified by their uid, access_token and client headers. |
/api/v1/auth | PUT | Account updates. This route will update an existing user's account settings. The default accepted params are password and password_confirmation |
/api/v1/auth/sign_in | POST | Email authentication. Requires email and password as params. This route will return a JSON representation of the User model on successful login along with the access-token and client in the header of the response. |
/api/v1/auth/sign_out | DELETE | Use this route to end the user's current session. This route will invalidate the user's authentication token. You must pass in uid, client, and access-token in the request headers. |
/api/v1/auth/validate_token | GET | Use this route to validate tokens on return visits to the client. Requires uid, client, and access-token as params. These values should correspond to the columns in your User table of the same names. |
/api/v1/auth/password | PUT | Use this route to change users' passwords. Requires password and password_confirmation as params. |
/api/v1/auth/password/edit | GET | Verify user by password reset token. This route is the destination URL for password reset confirmation. This route must contain reset_password_token and redirect_url params. These values will be set automatically by the confirmation email that is generated by the password reset request. |
/api/v1/templates | GET | Get the full catalog of cards template that Card Mine provides. |
/api/v1/cards/ | GET | Get all of the signed in user's card. |
/api/v1/cards/ | POST | Create a new card for the currently signed in user. |
/api/v1/cards/:id | GET | Get a specific card of the signed in user. |
/api/v1/cards/:id | PUT | Update a specific card of the signed in user. |
/api/v1/cards/:id | DELETE | Destroys the specified card record along with its related textual content records. |
/api/v1/cards/:card_id/textual_content | GET | Returns all the texts associated with a specific card with all relative information of the textual content. |
/api/v1/cards/:card_id/textual_content | POST | Create a new textual content for the specified card. |
/api/v1/cards/:card_id/textual_content/:id | GET | Return the textual content record with the provided id parameter. |
/api/v1/cards/:card_id/textual_content/:id | PUT | Updates the textual content record with the provided id parameter. |
/api/v1/cards/:card_id/textual_content/:id | DELETE | Destroys the textual content record with the provided id parameter. |
A the complete documentation will be provided soon.
Card Mine API version can be consumed online via heroku: http://cardmine.herokuapp.com/.
For example, the following snippet gets the catalog of existing card templates in json form:
curl -X GET http://cardmine.herokuapp.com/api/v1/templates
Access to all API resources (except static content) is restricted to request with valid token that adheres to HTTP Token Authentication.
Refer to this repo to review the app code and related files.
Add throttling and clients access keys.- Document the API extensively.