API Reference¶
Serializations¶
Responses from the MLTSHP API are application/json responses that represent the various MLTSHP API objects. Those objects are:
- shake¶
-
A shake is a stream of files posted to MLTSHP by users. Shakes can be user shakes, which every user has one of, or group shakes that can have multiple posters.
Contents: - id – the shake’s numeric shake ID as a number
- name – the display title of the shake
- owner – the user who created the shake
- url – the URL of the shake on the MLTSHP site
- thumbnail_url – the URL of the shake’s thumbnail logo image
- description – the shake’s description displayed under its logo on its page (optional)
-
type – the type of shake: either
user
orgroup
- created_at – the time when the shake was first created
- updated_at – the time when the shake was last updated
-
A file that someone posted to a shake. A file can be either an image or a link to a video.
Contents: - sharekey – the sharekey of the shared file
- name – the filename of the shared file
- user – the user who shared the file
- title – the custom title the poster gave the file (optional)
- description – the caption displayed under the file on its page (optional)
- posted_at – the time the file was posted
- permalink_page – the URL where the file can be viewed on MLTSHP
- width – the width of the file (image or video embed) in pixels as a number
- height – the height of the file (image or video embed) in pixels as a number
- views – the number of times the image has been viewed
- likes – the number of times the image has been “liked” to someone’s favorites
- saves – the number of times the image has been saved to another shake
- comments – the number of comments on the file
- nsfw – whether the file has been marked NSFW, and so is hidden by default when displayed on MLTSHP (true for NSFW/hidden, false for SFW/visible)
- original_image_url – if the file is an image, the URL of the image on MLTSHP
- url – if the file is not an image, the original URL of the shared item
- pivot_id – a key that is used for pagination. It varies based on the API method.
- saved – flag indicating whether authenticated user has already saved the sharedfile
- liked – flag indicating whether authenticated user has already liked the sharedfile
-
The alphanumeric ID of a sharedfile, such as
GK4N
. These are the codes in the permalink page (and image URL) of files posted to MLTSHP.
- timestamp¶
-
Timestamps represent particular times when events occurred, such as users posting files to shakes. Timestamps are always represented in the MLTSHP API as ISO8601 timestamps in UTC (where the timezone is
Z
) with resolution to seconds (no microseconds).
- user¶
-
A person with a MLTSHP account. Users own or manage shakes and post files in them.
Contents: - id – the user’s numeric user ID as a number
- name – the user’s username
- profile_image_url – the URL to the user’s profile picture
- about – a brief text blurb about the user. Only available when querying the user resource.
- website – the user’s URL. Only available when querying the user resource.
- shakes – the list of shakes that belong to the user, including their main user shake. Only available when querying the user resource.
- comment¶
-
A traditional comment associated with a sharedfile.
Contents:
Resources¶
The resources (URL endpoints) in the MLTSHP API are:
-
GET
/api/favorites
¶
-
GET
/api/favorites/before/
(beforekey)¶
-
GET
/api/favorites/after/
(afterkey)¶ -
Returns the files the authorized user has “liked” most recently (or as specified).
Use the
before/beforekey
andafter/afterkey
variations to page through the user’s favorites. That is, specify the last pivot_id as the key to thebefore/beforekey
resource to get the page of files the user “liked” before the current page.Parameters: - beforekey – the pivot_id of the file to show posts before
- afterkey – the pivot_id of the file to show posts after
Status Codes: -
200 OK
–
the response is the requested section of the user’s favorites as an object containing:
- favorites – a list of sharedfiles
-
GET
/api/friends
¶
-
GET
/api/friends/before/
(beforekey)¶
-
GET
/api/friends/after/
(afterkey)¶ -
Returns the files posted most recently (or as specified) by the users whom the authorized user follows.
Use the
before/beforekey
andafter/afterkey
variations to page through the user’s friend shake. That is, to request the next page of a friend shake, specify the last pivot_id in the current page as the key to a/api/friends/before/beforekey
request.Parameters: - beforekey – the pivot_id of the post to show posts before
- afterkey – the pivot_id of the post to show posts after
Status Codes: -
200 OK
–
the response is the requested section of friend shake as an object containing:
- friend_shake – a list of sharedfiles
-
GET
/api/magicfiles
¶
-
GET
/api/magicfiles/before/
(beforekey)¶
-
GET
/api/magicfiles/after/
(afterkey)¶ -
Returns the 10 most recent files accepted by the “magic” file selection algorithm. Currently any files with 10 or more likes are magic.
Use the
before/beforekey
andafter/afterkey
variations to page through the sharedfiles. That is, specify the last pivot_id as the key to thebefore/beforekey
resource to get the page of files saved before the current page.Parameters: - beforekey – the pivot_id of the file to show posts before
- afterkey – the pivot_id of the file to show posts after
Status Codes: -
200 OK
–
the response is the latest magic files as an object containing:
- magicfiles – a list of sharedfiles
-
GET
/api/incoming
¶
-
GET
/api/incoming/before/
(beforekey)¶
-
GET
/api/incoming/after/
(afterkey)¶ -
Returns the 10 most recently posted sharedfiles.
Use the
before/beforekey
andafter/afterkey
variations to page through the sharedfiles. That is, specify the last pivot_id as the key to thebefore/beforekey
resource to get the page of files saved before the current page.Parameters: - beforekey – the pivot_id of the file to show posts before
- afterkey – the pivot_id of the file to show posts after
Status Codes: -
200 OK
–
the response is the latest files as an object containing:
- incoming – a list of sharedfiles
-
GET
/api/shakes/
(id)¶
-
GET
/api/shakes/
(id)/before/
(beforekey)¶
-
GET
/api/shakes/
(id)/after/
(afterkey)¶ -
Returns the sharedfiles for the specified shake in reverse chronological order.
Use the
before/beforekey
andafter/afterkey
variations to page through the sharefiles. That is, specify the last pivot_id as the key to thebefore/beforekey
resource to get the page of files saved before the current page.Parameters: - beforekey – the pivot_id of the file to show posts before
- afterkey – the pivot_id of the file to show posts after
Status Codes: -
200 OK
–
the response is the requested section of shake’s sharedfiles:
- sharedfiles – a list of the shake’s sharedfiles
- 401 Unauthorized – authentication failed
-
GET
/api/shake_id/
(int: shakeid)¶ -
Returns information for the shake with the given numeric shake ID.
Parameters: - shakeid – the shake’s numeric ID
Status Codes: - 200 OK – the response is the requested shake
- 404 Not Found – no such shake with that ID
-
GET
/api/shake_name/
(shakepathname)¶ -
Returns information for the shake with the given pathname.
Note that name in this case refers to the URL path to the shake. e.g., for https://mltshp.com/weloveamberandandre the pathname is weloveamberandandre.
Parameters: - shakepathname – the shake’s pathname
Status Codes: - 200 OK – the response is the requested shake
- 404 Not Found – no such shake with that pathname
-
GET
/api/shake_user/
(username)¶ -
Returns information for the shake belonging to the specified user.
Parameters: - username – the user’s username
Status Codes: - 200 OK – the response is the requested shake
- 404 Not Found – no such user with that name
-
GET
/api/shakes
¶ -
Returns the authorized user’s shakes.
Status Codes: -
200 OK
–
the response is an object containing:
- shakes – a list of the user’s shakes
- 401 Unauthorized – authentication failed
-
200 OK
–
-
Returns information for the file with the given share key.
Parameters: - sharekey – the sharekey of the file
Status Codes: - 200 OK – the response is a sharedfile for the requested file
- 404 Not Found – no such file with that share key
-
Update sharedfile’s editable details.
Parameters: - sharekey – the sharekey of the file
Form Parameters: - title – text for the image title (optional)
- description – text for the image description (optional)
Status Codes: - 200 OK – the response is a sharedfile for the requested file
- 403 Forbidden – the file could not be updated due to permission issues
- 404 Not Found – no such file with that share key
-
“Likes” the file with the given sharekey as the authorized user. The file is then available in the user’s favorites.
Parameters: - sharekey – the sharekey of the file to like
Status Codes: - 200 OK – the file was liked, and the response is the liked sharedfile
- 400 Bad Request – the file could not be liked, probably because the authorized user already liked it
- 404 Not Found – no such file with that share key
-
“Saves” the file with the given sharekey as the authorized user. By default the file is saved to the user’s shake unless the shake_id parameter is provided.
Parameters: - sharekey – the sharekey of the file to save
Form Parameters: - shake_id – the id of the destination shake the file should be saved to (optional)
Status Codes: - 200 OK – the file was saved, and the response is the saved sharedfile
- 400 Bad Request – the file could not be saved, probably because the file belongs to the authenticated user
- 403 Forbidden – the file could not be saved due to permission issues
- 404 Not Found – no such file with that share key or no such shake
-
Returns a list of comments for the sharedfile with the given sharekey.
Parameters: - sharekey – the sharekey of the file
Status Codes: - 404 Not Found – no such file with that sharekey or no such shake
-
200 OK
–
an object containing:
- comments – a list of comments
-
Posts a new comment on behalf of the authenticated user to the sharedfile referenced with the given sharekey.
Parameters: - sharekey – the sharekey of the file
Form Parameters: - body – the text contents of the comment
Status Codes: - 404 Not Found – no such file with that sharekey or no such shake
- 400 Bad Request – the comment could not be saved due to a missing parameter or failed spam check
- 200 OK – the newly posted comment object
-
POST
/api/upload
¶ -
Adds the submitted image to a shake. Images should be provided as multipart/form-data request bodies.
Form Parameters: - file – the file data of the image to upload
- shake_id – numeric ID of the shake to post to (optional)
- title – text for the image title (optional)
- description – text for the image description (optional)
Status Codes: - 201 Created – the image was posted to the shake, and the response body is an abbreviated sharedfile representing it, containing only sharekey and name
- 400 Bad Request – the file could not be identified as an image
-
GET
/api/user
¶ -
Returns the authorized user.
Status Codes:
-
GET
/api/user_id/
(int: userid)¶ -
Returns information for the user with the given numeric user ID.
Parameters: - userid (int) – the user’s numeric ID
Status Codes: - 200 OK – the response is the requested user
- 404 Not Found – no such user with that ID
-
GET
/api/user_name/
(username)¶ -
Returns the user with the given username.
Parameters: - username – the user’s username
Status Codes: - 200 OK – the response is the requested user
- 404 Not Found – no such user with that name