How it works?
In order to create a swift using our api, you need to know how it works in the backend.
Just sending texts and media files at one time to create a swift will not work, since it is created step by step.
Description of how the system works when creating a swift, that is (Image / Video) story
- 1. First you upload 1 media file Video or Image
- 2. Then just publish the swift using the endpoints described below
Upload swift media
Please use this (https://sufred.com/mobile_api/upload_swift_media) API endpoint for uploading swift media file. I.e Video or Image
Post parameters
Field | Value | Remarks |
---|---|---|
session_id | Access token ID | E.g. de25cc16eb00960f076... |
type | Media file type (image/video) | E.g. image |
file | Media file (Image/Video) | E.g. some-selfy-picture.jpeg |
Success response (Image uplaod)
{
"code": 200,
"message": "Media file uploaded successfully",
"data":{
"url": "http://colibri.loc/upload/images/xxxx/xx/e7tHaq16_2d.......c5_image_swift.jpeg",
"type": "image"
}
}
Success response (Video uplaod)
{
"code": 200,
"message": "Media file uploaded successfully",
"data":{
"url": "http://colibri.loc/upload/videos/xxxx/xx/e7tHaq16_2d.......c5_image_swift.mp4",
"type": "video"
}
}
Error responses
{
"code": 401,
"data": [],
"message": "Unauthorized Access"
}
{
"code": 500,
"message": "Media file is missing or invalid",
"data": []
}
{
"code": 400,
"message": "Media file type is missing or invalid",
"data": []
}
{
"code": 400,
"message": "You cannot attach more than 10 images to a post",
"data": []
}
Delete swift media
Please use this (https://sufred.com/mobile_api/delete_swift_media) API endpoint for deleteing swift media file
In this case, you just need to send the above request to delete the swift media file, that is, a request without additional parameters, since the system itself will determine which file was last uploaded and delete it
Post parameters
Field | Value | Remarks |
---|---|---|
session_id | Access token ID | E.g. de25cc16eb00960f076... |
Success response
{
"code": 200,
"data": [],
"message": "Media deleted successfully"
}
Error responses
{
"code": 401,
"data": [],
"message": "Unauthorized Access"
}
Publish swift
Please use this (https://sufred.com/mobile_api/publish_swift) API endpoint for pulishing swift
This stage of creating a swift assumes that you have already uploaded a media file, that is, a video or an image of a swift. Since the media file is required when creating a swift, unlike the description, you can send the description or not.
Post parameters
Field | Value | Remarks |
---|---|---|
session_id | Access token ID | E.g. de25cc16eb00960f076... |
swift_text | Text text message (Max. 200 chars) | E.g. `Lorem ipsum` |
Success response
{
"code": 400,
"code": 200,
"message": "Swift published successfully",
"data": []
}
Error responses
{
"code": 401,
"data": [],
"message": "Unauthorized Access"
}
Delete swift
Please use this (https://sufred.com/mobile_api/delete_swift) API endpoint for deleteing swift
Post parameters
Field | Value | Remarks |
---|---|---|
session_id | Access token ID | E.g. de25cc16eb00960f076... |
swid | Swift hash id | E.g. `zpad2HalsbsLGhdI` |
Success response
{
"code": 200,
"message": "Swift successfully deleted",
"data": []
}
Error responses
{
"code": 401,
"data": [],
"message": "Unauthorized Access"
}
Get my swifts list
Please use this (https://sufred.com/mobile_api/get_swifts) API endpoint for fetching user swifts list
This endpoint will allow you to get all active swifts of the logged in user
GET parameters
Field | Value | Remarks |
---|---|---|
session_id | Access token ID | E.g. de25cc16eb00960f076... |
Success response
{
"code": 200,
"data":[
{
"id": 5,
"username": "@admin",
"fname": "Mansur",
"lname": "ATL",
"avatar": "http://colibri.loc/upload/avatars/xx/xx/ZIGRH9xMQ5YXeo7s1FtI_....._thumbnail_512x512.jpeg",
"swift":[
{
"views":[
"1": {
"id": 1,
"username": "@testuser",
"fname": "Admin",
"lname": "O'user",
"avatar": "http://colibri.loc/upload/avatars/xx/xx/ZyoImsndzRPftd1UbMW5_24_3126....e6_thumbnail_512x512.jpg",
"name": "Admin O'user",
"url": "http://colibri.loc/@testuser",
"time": "24 seconds ago"
}
],
"time": "19:24",
"type": "image",
"status": "active",
"media":{
"src": "http://colibri.loc/upload/images/xx/xx/lr4UGK....54450_image_swift.png"
},
"exp_time": 1623947062,
"text": "",
"seen": 0,
"swid": "uNpuf6SrlRzQ3xVg"
}
],
"name": "Mansur ATL",
"url": "http://colibri.loc/@admin",
"is_user": true,
"has_unseen": false
}
],
"message": "Swifts fetched successfully"
}
Error responses
{
"code": 401,
"data": [],
"message": "Unauthorized Access"
}
{
"code": 404,
"data": [],
"message": "No swifts available yet"
}
Register swift view
Please use this (https://sufred.com/mobile_api/reg_swift_view) API endpoint for registering swift views
This endpoint is needed in order to send a request to the server when the swift is opened so that the system registers the swift view.
Post parameters
Field | Value | Remarks |
---|---|---|
session_id | Access token ID | E.g. de25cc16eb00960f076... |
user_id | Swift user ID | E.g. `10` |
swid | Swift hash id | E.g. `zpad2HalsbsLGhdI` |
Success response
{
"code": 200,
"message": "Swift view registered successfully",
"data": []
}
Error responses
{
"code": 401,
"data": [],
"message": "Unauthorized Access"
}
{
"code": 400,
"data":[],
"message": "User ID is not valid or missing"
}