Skip to content

Endpoints

Aditya Vaidyam edited this page Feb 4, 2017 · 5 revisions

Here are the possible endpoints available in this API:

Note: ALL headers require authentication tokens to be passed in the Authorization: Bearer schema, unless specified.


Authenticate

  • GET authenticate/
    • Description: Checks that the token is valid and the user therefore authenticated.
    • Request: none
    • Response:
    {
        result: true
    }
    
  • POST authenticate/
    • Authentication: not required.
    • Description: Authenticate a username-password combination and return a valid token for future API requests.
    • Request:
    {
        username: <username>,
        password: <password>
    }
    
    • Response:
    {
        result: <authentication API token>
    }
    
  • PATCH authenticate/
    • Description: Exchanges and re-authenticates the user, returning a new valid token.
    • Request: none
    • Response:
    {
        result: <authentication API token>
    }
    
  • DELETE authenticate/
    • Description: Revokes the authentication token, thereby invalidating all tokens issued for this user currently.
    • Request: none
    • Response:
    {
        result: true
    }
    

Users

  • GET user/@username
    • Description: Get personal details (excluding password and modification) of the @username given.
    • Request: none
    • Response:
    {
        result: {
            username: <username>,
            name: <full name>,
            careerid: <Purdue Career Account ID>
        }
    }
    
  • POST user/@username
    • Authentication: not required.
    • Description: Create a new user with the provided information.
    • Request:
    {
        username: <username>,
        password: <password>,
        name: <full name>,
        careerid: <Purdue Career Account ID>
    }
    
    • Response:
    {
        result: {
            username: <username>,
            name: <full name>,
            careerid: <Purdue Career Account ID>
        }
    }
    
  • PATCH user/@username
    • Description: Update a user's name, password, or Career Account ID. At least one field is required, but any can be provided together.
    • Request:
    {
        password: <password>,
        name: <full name>,
        careerid: <Purdue Career Account ID>
    }
    
    • Response:
    {
        result: {
            username: <username>,
            name: <full name>,
            careerid: <Purdue Career Account ID>
        }
    }
    
  • DELETE user/@username
    • Description: Deletes the given user.
    • Request: none
    • Response:
    {
        result: <true or false>
    }
    
  • GET user/me
    • Description: Convenience endpoint for retrieving the current user's information.
    • Request: none
    • Response:
    {
        result: {
            username: <username>,
            name: <full name>,
            careerid: <Purdue Career Account ID>
        }
    }
    
  • GET users
    • Description: Retrieve ALL existing users in the system and their information.
    • Request: none
    • Response:
    {
        result: [
            {
                username: <username>,
                name: <full name>,
                careerid: <Purdue Career Account ID>
            },
            {
                username: <username>,
                name: <full name>,
                careerid: <Purdue Career Account ID>
            },
            ...
        ]
    }
    

Clone this wiki locally