Skip to content
This repository has been archived by the owner on Aug 6, 2021. It is now read-only.

Testing Routes with Curl

Christian Schulze edited this page May 1, 2015 · 7 revisions

User and Token Creation

Create a User

curl -i -X POST -d "email=foo&password=bar" http://localhost:7667/api/v1/users

results in:

{"message":"registered user","_id":"5543410f7dc0ad507f6574cf"}~  

Get Token

curl -i -X POST -d '{"email":"foo", "password": "bar"}' http://localhost:7667/api/v1/users/5543410f7dc0ad507f6574cf/authenticate

results in:

{"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6ImZvbyJ9.R8yXEp8NHQIDvM1ayoBIuc88go0mQx2UmGkJB7fEcYg"}~         

User Methods

Get the User

curl -i -X GET -H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6ImZvbyJ9.R8yXEp8NHQIDvM1ayoBIuc88go0mQx2UmGkJB7fEcYg" http://localhost:7667/api/v1/users/5543410f7dc0ad507f6574cf

results in:

{"_id":"5543410f7dc0ad507f6574cf","email":"foo","creation_date":"2015-05-01T09:02:07.849Z"}~

Drop Methods

Initialize Drop

curl -i -X POST -H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6ImZvbzEifQ.ieioiEa_x97Ecx_DtObiYP1NONP70BMnVinuC-36IGU" -H "Content-Type: multipart/form-data" http://localhost:7667/api/v1/users/554349c929acc49c0014f790/drops

results in:

{"_id":"5543a674b33192e209039e5b","url":"BASE_URL/4k4BqScnf"}~ 

Upload file to Drop

curl -i -X POST -H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6ImZvbzEifQ.ieioiEa_x97Ecx_DtObiYP1NONP70BMnVinuC-36IGU" -H "Content-Type: multipart/form-data" -F "[email protected]" http://localhost:7667/api/v1/users/554349c929acc49c0014f790/drops/5543d399f159dc4c3afe96d7

results in:

TODO

Delete Drop

curl -i -X DELETE -H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6ImZvbzEifQ.ieioiEa_x97Ecx_DtObiYP1NONP70BMnVinuC-36IGU" -H "Content-Type: multipart/form-data" http://localhost:7667/api/v1/users/554349c929acc49c0014f790/drops/5543d399f159dc4c3afe96d7

results in:

TODO