How it works?
Swift creation is a two-step process: upload one image or video first, then publish the uploaded media as a swift.
Available interfaces
-
Web application API: uses the authenticated browser session and CSRF token through
native_api/swift/*. It does not usesession_id. -
Public system API: uses the
mobile_api/*endpoints and asession_idaccess token. This interface is available only when the site'ssystem_api_statussetting is enabled.
Creation flow
- Upload one image or video.
- Publish the uploaded media, optionally with up to 200 characters of text.
- Use the get, delete, and view endpoints described in the following tabs.
The web interface has separate image and video upload actions. The public API uses one upload endpoint with a
type field set to image or video.
Upload swift media
Upload one image or video before publishing a swift. The uploaded media remains as the current draft until it is published or deleted.
Endpoints
| Interface | Endpoint | Authentication |
|---|---|---|
| Web image upload | https://5itui.com/native_api/swift/upload_swift_image |
Logged-in browser session and CSRF token |
| Web video upload | https://5itui.com/native_api/swift/upload_swift_video |
Logged-in browser session and CSRF token |
| Public system API | https://5itui.com/mobile_api/upload_swift_media |
session_id; requires system_api_status=on |
Public API POST parameters
| Field | Value | Remarks |
|---|---|---|
| session_id | Access token ID | E.g. de25cc16eb00960f076... |
| type | image or video |
Media type |
| file | Multipart media file | Allowed image extensions: jpg,png,jpeg,gif. Allowed video extensions: mp4,mov,3gp,webm. |
Web application POST parameters
| Endpoint | File field | Remarks |
|---|---|---|
upload_swift_image |
image |
The browser session and CSRF token are sent by the web application. |
upload_swift_video |
video |
Video processing is queued and may finish after the upload response. |
Public API success response
{
"code": 200,
"message": "Media file uploaded successfully",
"data": {
"url": "https://example.com/upload/images/xx/xx/swift.jpg",
"type": "image"
}
}
Web application success responses
Image:
{
"status": 200,
"img": {"url": "https://example.com/upload/images/xx/xx/swift.jpg"}
}
Video:
{
"status": 200,
"video": {"source": "https://example.com/upload/videos/xx/xx/swift.mp4"}
}
The public video endpoint returns after the video job has been queued. The web video endpoint also exposes the queued state to the browser while the worker finishes processing.
Error responses
Public system API:
{
"code": 401,
"data": [],
"message": "Unauthorized Access"
}
{
"code": 400,
"data": [],
"message": "Media file type is missing or invalid"
}
{
"code": 500,
"data": [],
"message": "Media file is missing or invalid"
}
{
"code": 500,
"data": [],
"message": "Video processing queue is unavailable"
}
Delete swift media
Delete the media belonging to the current unpublished swift draft. This is useful when the user cancels an upload before publishing it.
Endpoints
| Interface | Endpoint | Authentication |
|---|---|---|
| Web image draft | https://5itui.com/native_api/swift/delete_swift_image |
Logged-in browser session and CSRF token |
| Web video draft | https://5itui.com/native_api/swift/delete_swift_video |
Logged-in browser session and CSRF token |
| Public system API | https://5itui.com/mobile_api/delete_swift_media |
session_id; requires system_api_status=on |
Public API POST parameters
| Field | Value | Remarks |
|---|---|---|
| session_id | Access token ID | E.g. de25cc16eb00960f076... |
The web endpoints do not need an additional ID; they delete the current draft associated with the browser session.
Success response
Web application:
{
"status": 200
}
Public system API:
{
"code": 200,
"data": [],
"message": "Media deleted successfully"
}
Error response
{
"code": 401,
"data": [],
"message": "Unauthorized Access"
}
Publish swift
Publish the media that was uploaded for the current swift draft. The text is optional and is limited to 200 characters.
Endpoints
| Interface | Endpoint | Authentication |
|---|---|---|
| Web application | https://5itui.com/native_api/swift/publish_new_swift |
Logged-in browser session and CSRF token |
| Public system API | https://5itui.com/mobile_api/publish_swift |
session_id; requires system_api_status=on |
POST parameters
| Field | Value | Remarks |
|---|---|---|
| session_id | Access token ID | Required only by the public system API. E.g. de25cc16eb00960f076... |
| swift_text | Text message | Optional; maximum 200 characters. E.g. Lorem ipsum |
Success response
Web application:
{
"status": 200
}
Public system API:
{
"code": 200,
"message": "Swift published successfully",
"data": []
}
Error response
{
"code": 401,
"data": [],
"message": "Unauthorized Access"
}
Delete swift
Delete an existing swift owned by the authenticated user.
Endpoints
| Interface | Endpoint | Authentication |
|---|---|---|
| Web application | https://5itui.com/native_api/swift/delete_swift |
Logged-in browser session and CSRF token |
| Public system API | https://5itui.com/mobile_api/delete_swift |
session_id; requires system_api_status=on |
POST parameters
| Field | Value | Remarks |
|---|---|---|
| session_id | Access token ID | Required only by the public system API. E.g. de25cc16eb00960f076... |
| swid | Swift hash ID | E.g. zpad2HalsbsLGhdI |
Success response
Web application:
{
"status": 200
}
Public system API:
{
"code": 200,
"message": "Swift successfully deleted",
"data": []
}
Error response
{
"code": 401,
"data": [],
"message": "Unauthorized Access"
}
Get swifts list
This endpoint returns the active swifts available to the authenticated user.
Endpoints
| Interface | Endpoint | Authentication |
|---|---|---|
| Web application | https://5itui.com/native_api/swift/get_swifts |
Logged-in browser session and CSRF token |
| Public system API | https://5itui.com/mobile_api/get_swifts |
session_id; requires system_api_status=on |
Public API GET parameters
| Field | Value | Remarks |
|---|---|---|
| session_id | Access token ID | E.g. de25cc16eb00960f076... |
The web endpoint uses the current browser session and accepts no session_id parameter.
Web application success response
{
"status": 200,
"data": []
}
Public API success response
{
"code": 200,
"data": [
{
"id": 5,
"username": "@admin",
"fname": "Mansur",
"lname": "ATL",
"avatar": "https://example.com/upload/avatars/xx/xx/avatar.jpg",
"swift": [
{
"views": {
"1": {
"id": 1,
"username": "@testuser",
"fname": "Admin",
"lname": "User",
"avatar": "https://example.com/upload/avatars/xx/xx/avatar.jpg",
"name": "Admin User",
"url": "https://example.com/@testuser",
"time": "24 seconds ago"
}
},
"time": "19:24",
"type": "image",
"status": "active",
"media": {
"src": "https://example.com/upload/images/xx/xx/swift.jpg"
},
"exp_time": 1623947062,
"text": "",
"seen": 0,
"swid": "uNpuf6SrlRzQ3xVg"
}
],
"name": "Mansur ATL",
"url": "https://example.com/@admin",
"is_user": true,
"has_unseen": false
}
],
"message": "Swifts fetched successfully"
}
Error responses
Web application:
{
"status": 400,
"error": "Invalid access token"
}
Public system API:
{
"code": 401,
"data": [],
"message": "Unauthorized Access"
}
{
"code": 404,
"data": [],
"message": "No swifts available yet"
}
Register swift view
Register a view when a swift is opened. A user cannot register a view on their own swift, and an existing view is not counted twice.
Endpoints
| Interface | Endpoint | Authentication |
|---|---|---|
| Web application | https://5itui.com/native_api/swift/swift_view |
Logged-in browser session and CSRF token |
| Public system API | https://5itui.com/mobile_api/reg_swift_view |
session_id; requires system_api_status=on |
POST parameters
| Field | Value | Remarks |
|---|---|---|
| session_id | Access token ID | Required only by the public system API. E.g. de25cc16eb00960f076... |
| user_id | Swift owner user ID | E.g. 10 |
| swid | Swift hash ID | E.g. zpad2HalsbsLGhdI |
Success response
Web application:
{
"status": 200
}
Public system API:
{
"code": 200,
"message": "Swift view registered successfully",
"data": []
}
Error responses
Public system API:
{
"code": 401,
"data": [],
"message": "Unauthorized Access"
}
{
"code": 400,
"data": [],
"message": "User ID is not valid or missing"
}