Skip to content

projectweekend/Links-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

141 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The RESTful API for what will become: http://links.projectweekend.net

Development Environment

The development environment for this project is fully bootstrapped and portable with the help of: Vagrant, Docker, and Fig. If using Linux, all of the Vagrant stuff can be ignored since Docker runs natively.

  • vagrant up - Start the VM. On first launch a lot of things need to be downloaded and installed so it could take a little while. Subsequent launches are much faster.
  • vagrant ssh - Connect to the VM
  • vagrant halt - Shut down the VM
  • vagrant destroy - Delete the VM.
  • /vagrant - The path on the VM where the project code is mounted. All fig commands mus be executed from this path.
  • fig up - Start the web application and database containers. On first launch base containers will be downloaded from the Docker Registry so it could take a while. Subsequent launches are much faster.
  • fig build - Rebuild the web application container. This needs to be done any time a new Python dependency is added to requirements.txt
  • fig run web python manage.py syncdb - Run Django's syncdb command on a new database.
  • fig run web python manage.py migtrate - Apply South database migrations
  • fig run web python manage.py test - Run all project tests

Register a new user

POST: /v1/maker/register

Body:

{
    "email": "test@test.com",
    "password": "adfadsf",
    "first_name": "Thomas",
    "last_name": "Jefferson"
}

Response: None

Status Codes:

  • 201 - Registration was created
  • 400 - Invalid request body

Verify new user email address

POST: /v1/maker/email/verification

Body:

{
    "token": "asdjfkal48a09d853qlkjadfl93&%3l2k"
}

Response: None

Status Codes:

  • 200 - Verification was successful
  • 400 - Invalid request body

Request password reset for user

POST: /v1/maker/password/reset

Body:

{
    "email": "test@test.com"
}

Response: None

Status Codes:

  • 201 - Reset request was created
  • 400 - Invalid request body

Reset password for user

POST: /v1/maker/password/reset/update

Body:

{
    "token": "alskdfj93lak4r&$@_23;lads",
    "new_password": "newPassword",
    "confirm_password": "newPassword"
}

Status Codes:

  • 200 - Authentication was successful
  • 400 - Invalid request body
  • 412 - Invalid reset token

Authenticate user

POST: /v1/maker/authenticate

Body:

{
    "identifier": "test@test.com",
    "password": "adfadsf"
}

Response:

{
    "token": "kja03984q0oaj34j*@$Fmjadfl"
}

Status Codes:

  • 200 - Authentication was successful
  • 400 - Invalid request body
  • 401 - Invalid identifier/password

Request email change for user

POST: /v1/maker/email

Body:

{
    "new_email": "something@different.com"
}

Response: None

Status Codes:

  • 201 - Request was created
  • 400 - Invalid request body
  • 409 - Email in use

Change password for user

POST: /v1/maker/email/update

Body:

{
    "token": "jal39aULJ3IRA90W3R0@appsd03"
}

Response: None

Status Codes:

  • 200 - Change was successful
  • 400 - Invalid request body
  • 412 - Invalid change token

Get logged in user detail

GET: /v1/maker/self

Response:

{
    "id": 3,
    "identifier": "test@test.com",
    "first_name": "Thomas",
    "last_name": "Jefferson",
    "email": "test@test.com",
    "photo_url": "http://urlforphoto.com/image/something.jpg",
    "bio": "This is my optional bio",
    "joined": "2014-08-18T12:32:58.930Z"
}

Status Codes:

  • 200 - Request was successful
  • 401 - Not logged in

Get list of users

GET: /v1/maker

Response:

{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 3,
            "identifier": "test@test.com",
            "first_name": "Thomas",
            "last_name": "Jefferson",
            "email": "test@test.com",
            "photo_url": "http://urlforphoto.com/image/something.jpg",
            "bio": "This is my optional bio",
            "joined": "2014-08-18T12:32:58.930Z",
            "folders": [],
            "links": []
        }
    ]
}

Status Codes:

  • 200 - Request was successful
  • 401 - Not logged in

Get single user

GET: /v1/maker/:id

Response:

{
    "id": 3,
    "identifier": "test@test.com",
    "first_name": "Thomas",
    "last_name": "Jefferson",
    "email": "test@test.com",
    "photo_url": "http://urlforphoto.com/image/something.jpg",
    "bio": "This is my optional bio",
    "joined": "2014-08-18T12:32:58.930Z",
    "folders": [],
    "links": []
}

Status Codes:

  • 200 - Request was successful
  • 401 - Not logged in

Add a folder

POST: /v1/folder

Body:

{
    "name": "Cool Links",
    "Description": "Random links I thought were cool",
    "is_public": true
}

Response:

{
    "id": 1,
    "name": "Cool Links",
    "description": "Random links I thought were cool",
    "is_public": true,
    "created": "2014-08-19T00:05:51.611Z"
}

Status Codes:

  • 201 - Folder was created
  • 400 - Invalid request body
  • 401 - Not logged in
  • 409 - Duplicate folder name

Get list of folders for logged in user

GET: /v1/folder

Response:

{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 1,
            "name": "Cool Links",
            "description": "Random links I thought were cool",
            "links": [
                {
                    "id": 2,
                    "folder": 1,
                    "url": "https://learn.adafruit.com/flora-and-codebender",
                    "note": "Using Codebender with Flora",
                    "photo_url": "",
                    "created": "2014-08-04T00:00:26.284Z"
                }
            ],
            "is_public": true,
            "created": "2014-08-03T23:23:43.117Z"
        }
    ]
}

Status Codes:

  • 200 - Request was successful
  • 401 - Not logged in

Get single folder for logged in user

GET: /v1/folder/:id

Response:

{
    "id": 1,
    "name": "Cool Links",
    "description": "Random links I thought were cool",
    "links": [
        {
            "id": 2,
            "folder": 1,
            "url": "https://learn.adafruit.com/flora-and-codebender",
            "note": "Using Codebender with Flora",
            "photo_url": "",
            "created": "2014-08-04T00:00:26.284Z"
        }
    ],
    "is_public": true,
    "created": "2014-08-03T23:23:43.117Z"
}

Status Codes:

  • 200 - Request was successful
  • 401 - Not logged in
  • 404 - Folder does not exist

Add a link

POST: /v1/link

Body:

{
    "url":"https://learn.adafruit.com/flora-and-codebender",
    "note":"Using Codebender with Flora",
    "folder":1
}

Response:

{
    "id": 3,
    "folder": 1,
    "url": "https://learn.adafruit.com/flora-and-codebender",
    "note": "Using Codebender with Flora",
    "photo_url": "",
    "created": "2014-08-19T00:43:18.064Z"
}

Status Codes:

  • 201 - Link was created
  • 400 - Invalid request body
  • 401 - Not logged in

Get list of links for logged in user

GET: /v1/link

Response:

{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 3,
            "folder": null,
            "url": "https://learn.adafruit.com/flora-and-codebender",
            "note": "Using Codebender with Flora",
            "photo_url": "",
            "created": "2014-08-19T00:43:18.064Z"
        }
    ]
}

Status Codes:

  • 200 - Request was successful
  • 401 - Not logged in

Get single links for logged in user

GET: /v1/link/:id

Response:

{
    "id": 3,
    "folder": null,
    "url": "https://learn.adafruit.com/flora-and-codebender",
    "note": "Using Codebender with Flora",
    "photo_url": "",
    "created": "2014-08-19T00:43:18.064Z"
}

Status Codes:

  • 200 - Request was successful
  • 401 - Not logged in
  • 404 - Link does not exist

About

The RESTful API for what will become: http://links.projectweekend.net

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors