Skip to content

Update Author Profile

Fraser Redford edited this page Apr 15, 2021 · 3 revisions

POST author/<str:id>/

This will update the author object specified by the id in the request URL.

Request Header

Basic authorization (base64 encoded username:password):
--header "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="

or token authorization is required:
--header "Authorization: Token 9d9ed917fe1ead2d1e27ac7dc233348ed2e3d4c0"

Request Requirements

The host, ID, and URL of the author cannot be changed, however they can be sent in the request for a standard author object. A JSON object requiring the following:

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 Request

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

Sample Response

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

Response Codes

  • 200 OK upon a successful retrieval of a profile
  • 400 BAD REQUEST if bad information is passed in the request
  • 403 FORBIDDEN if an user is not authenticated
  • 404 NOT FOUND if the author does not exist
  • 409 CONFLICT if the displayName already exists

Clone this wiki locally