Skip to content

Author API

Fraser Redford edited this page Mar 29, 2021 · 21 revisions

GET author/<str:id>/

Description:

Retrieves the author object specified by the id

Request Body:

No Body Required

Sample Response:

{
    "type": "author",
    "id": "http://team6-project-socialdistrib.herokuapp.com/author/21d2d52bf3c34b84a45951d53b472a08",
    "host": "team6-project-socialdistrib.herokuapp.com",
    "displayName": "Jeff",
    "url": "http://team6-project-socialdistrib.herokuapp.com/author/21d2d52bf3c34b84a45951d53b472a08",
    "github": "https://github.com/Jeff"
}

POST

Description:

Updates the author object specified by the id in the request URL

Request Body:

Field Name: Value:
type (Optional) "author"
id (Optional) Should be a HATEOAS URL containing the UUID of the author at the end, will not be updated
host (Optional) The hostname of the authors server
displayName (Required) Should be a unique string for the users name
url (Optional) Should be the URL of the user on the server
github (Required) Should be the GitHub URL of the user

Sample Response:

{
    "type": "author",
    "id": "http://team6-project-socialdistrib.herokuapp.com/author/21d2d52bf3c34b84a45951d53b472a08",
    "host": "team6-project-socialdistrib.herokuapp.com",
    "displayName": "Jeff",
    "url": "http://team6-project-socialdistrib.herokuapp.com/author/21d2d52bf3c34b84a45951d53b472a08",
    "github": "https://github.com/Jeff"
}



/authors


GET

Description:

Will return a list of all authors registered with the local server

Body:

No Body Required

Sample Response:

[
    {
        "type": "author",
        "id": "http://team6-project-socialdistrib.herokuapp.com/author/21d2d52bf3c34b84a45951d53b472a08",
        "host": "team6-project-socialdistrib.herokuapp.com",
        "displayName": "Jeff",
        "url": "http://team6-project-socialdistrib.herokuapp.com/author/21d2d52bf3c34b84a45951d53b472a08",
        "github": "https://github.com/Jeff/"
    },
    {
        "type": "author",
        "id": "http://team6-project-socialdistrib.herokuapp.com/author/6978b496f79d59fa9aa9648bf88dbaaf",
        "host": "team6-project-socialdistrib.herokuapp.com",
        "displayName": "Jim",
        "url": "http://team6-project-socialdistrib.herokuapp.com/author/6978b496f79d59fa9aa9648bf88dbaaf",
        "github": "https:/tim.com/"
    }
]

Response

{
    "displayName": "Jon Snow",
    "github": "https://github.com/jonsnow" 
}

Response Code

  • On update and if a user is authorized 200 OK is returned
  • If unauthorized 403 FORBIDDEN is returned

Clone this wiki locally