Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

+++ +++ +++ CURRENT STATE OF THE API +++ +++ +++ #2

Open
uschtwill opened this issue Mar 8, 2015 · 6 comments
Open

+++ +++ +++ CURRENT STATE OF THE API +++ +++ +++ #2

uschtwill opened this issue Mar 8, 2015 · 6 comments

Comments

@uschtwill
Copy link
Owner

@alvinkatojr @tamzi @kevalsha

API/app can be found at:

https://salty-sierra-8863.herokuapp.com.

You have to specify that you want to use JSON in the request header. I recommend Postman (Chrome app) as a REST client.

API currently supports:

GET /entries

(WORKING) >> GET /entries >> to get all entries from the database, rails-controller: entries#index

curl -v -H 'Content-Type: application/json' -H 'Accept: application/json' https://salty-sierra-8863.herokuapp.com/entries

Output:

[ { "id": 1, "title": "Hello Keval", "url": "http://moringaschool.com", "author": "Will", "content": "I created this entry manually, so you have something to fetch via the API.", "published": "2015-08-03T00:00:00.000Z", "blog_id": 1 }, { "id": 2, "title": "Second Entry", "url": "http://google.com", "author": "Will", "content": "This is a second entry to be fetched.", "published": "2015-08-03T00:00:00.000Z", "blog_id": 1 } ]

GET /entries/:id

(WORKING) >> GET /entries/:id/ >> to get a specific entry from the database, rails-controller: entries#show

curl -v -H 'Content-Type: application/json' -H 'Accept: application/json' https://salty-sierra-8863.herokuapp.com/entries/1

Output:

{ "id": 1, "title": "Hello Keval", "url": "http://moringaschool.com", "author": "Will", "content": "I created this entry manually, so you have something to fetch via the API.", "published": "2015-08-03T00:00:00.000Z", "blog_id": 1 }

POST /api/sessions

(WORKING) >> POST /api/sessions >> to login with an existing user account, rails-controller: sessions#create

curl -v -H 'Content-Type: application/json' -H 'Accept: application/json' -X POST https://salty-sierra-8863.herokuapp.com/api/sessions -d "{"user":{"email":"[email protected]","password":"secret123"}}"

Output:

{ "success": true, "info": "Logged in", "data": { "auth_token": "WkL7z78Nu3HoTh6xe_1e" } }

DELETE /api/sessions

(NOT WORKING) >> DELETE /api/sessions >> to logout while being logged in, rails-controller: sessions#destroy

curl -v -H 'Content-Type: application/json' -H 'Accept: application/json' -X DELETE https://salty-sierra-8863.herokuapp.com/api/sessions/\?auth_token\=JRYodzXgrLsk157ioYHf

Output:

POST /api/registrations

(WORKING) >> POST /api/registrations >> to register a new user account, rails-controller: registrations#create

curl -v -H 'Content-Type: application/json' -H 'Accept: application/json' -X POST https://salty-sierra-8863.herokuapp.com/api//registrations -d "{"user":{"email":"[email protected]","password":"secret123","password_confirmation":"secret123"}}"

Output:

{ "success": true, "info": "Registered", "data": { "user": { "id": 6, "email": "[email protected]", "created_at": "2015-03-09T10:06:47.947Z", "updated_at": "2015-03-09T10:06:47.992Z", "authentication_token": "-raLH_DCfynVBQGAeUux" }, "auth_token": "-raLH_DCfynVBQGAeUux" } }

@uschtwill
Copy link
Owner Author

Hey @kevalsha, #1 is still an issue, but I manually added 2 entries so you can try out the above functionalities of the API (getting all and specific entries). Let me know, if that works.

@uschtwill
Copy link
Owner Author

@kevalsha 3 endpoints working now. Also updated documentation. Check above.

@uschtwill
Copy link
Owner Author

@alvinkatojr I have to show this to you. The login and logout endpoints react really weirdly. For the logout for instance, its definitely going though, but it is just not deleting the token. Can't wait for you to come in!

@uschtwill uschtwill added this to the MVP milestone Mar 9, 2015
@uschtwill
Copy link
Owner Author

@kevalsha Added return examples to documentation. See above.

@uschtwill uschtwill changed the title Current state of the API +++ +++ +++ Current state of the API +++ +++ +++ Mar 9, 2015
@alvinkatojr
Copy link
Collaborator

@uschtwill I am testing api endpoints from my side and they seem to be working. Is the logout the only issue with the api?

@uschtwill
Copy link
Owner Author

jep. everything else is working. @alvinkatojr

@uschtwill uschtwill changed the title +++ +++ +++ Current state of the API +++ +++ +++ +++ +++ +++ CURRENT STATE OF THE API +++ +++ +++ Mar 10, 2015
@uschtwill uschtwill removed this from the MVP milestone Mar 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants