updates - Hip-Hop-Xpress/hhx-api GitHub Wiki
The Hip Hop Xpress App will send users updates about events, courses, and other news regarding the Hip Hop Xpress and related organizations. This endpoint serves as a way for app clients to receive new updates.
{
"id": 0,
"title": "Double Dutch Boom Bus Playlists",
"dateCreated": "Thu May 14 2020 12:00:00 GMT-0500 (Central Daylight Time)",
"lastUpdated": null,
"author": "Hip Hop Xpress Admin",
"body": [
"As UIUC students wrap up their final exams of the semester, we want...",
"Check them out on our Instagram! @uiuchhx"
],
}These attributes are to be included in POST and PUT request bodies.
| Name | Type | Restrictions | Description |
|---|---|---|---|
id |
number |
must be unique non-zero integer, cannot be updated once created | unique identifier for update |
title |
string |
must be non-empty | title of the update |
author |
string |
must be non-empty | the author of the update |
body |
Array of string
|
must be non-empty | body text of the update |
These attributes are automatically created, immutable, and should not be included in your POST and PUT request bodies (doing so will result in errors)
| Name | Type | Restrictions | Description |
|---|---|---|---|
dateCreated |
string |
date format follows the toString() method of the Date JavaScript Object type
|
the date the update was created or released |
lastUpdated |
string or null
|
follows same format as dateCreated if not null
|
the date the update was last updated, or null if never updated |
A quick overview of all endpoints related to our updates:
POST /v1/updates
GET /v1/updates
GET /v1/updates/:id
PUT /v1/updates/:id
DELETE /v1/updates/:id
POST /v1/updates/:id/body
GET /v1/updates/:id/bodyAll use cases for the updates endpoints are listed below.
Collection wide:
Update specific:
- Retrieve an update:
GET /v1/updates/:id - Update an update:
PUT /v1/updates/:id - Delete an update:
DELETE /v1/updates/:id
Update data specific:
- Add body text for update:
POST /v1/updates/:id/body - Retrieve body text for update:
GET /v1/updates/:id/body
View the error documentation for what to expect if your request fails.
POST /v1/updates
Creates an update by including an update object (JSON) in the request body. All fields are required, and the id must be a unique, non-negative integer.
A valid update object (JSON) with correct attributes
The update object as added in the database
GET /v1/updates
Retrieves the data for all updates
None
An array of all update objects
GET /v1/updates/:id
Retrieves a specific update through its id, with :id being the desired update's id field.
None
The update object with specified id
PUT /v1/updates/:id
Updates specific attributes of an update object with id
An object containing only the attributes needing change, and their updated values. For example, if you need to change the title attribute, you only need to include the title field in your request: {"title": "some new title"}. However, any updated attributes must follow the attribute restrictions.
The updated update object
DELETE /v1/updates/:id
Deletes a specific update from the database by its id
None
The update object that was deleted
POST /v1/updates/:id/body
Adds text to a update's body by including the desired text in the request body.
Either a single string or an array of strings in the request body
The updated body (array of strings)
GET /v1/updates/:id/body
Retrieves all the text in a specific update's body
None
The body (array of strings)