HTTP API
#
Part I. Basic InstructionsDomain:
Seoul: https://api-ap-seoul-1.getway.sinso.io
London: https://api-uk-london-1.getway.sinso.io
Singapore: https://api-ap-singapore-1.getway.sinso.io
Token
Located in the Request Headers, named as Token, and should choose the correspondent area.
Public Response Structure
Successful Case Example
{ "ts": 1645088177, "code": 200, "error_code": 0, "message": "", "data": { "peers": 1, "blocks": 16792952, "funded": 3783426 }}
Successful Example of Using Paging Query
{ "ts": 1649923210, "code": 200, "error_code": 0, "message": "", "data": { "current": 1, "size": 1, "total": 20, "totalPage": 20, "records": [ { "id": 1, "fileName": "xxx.html", "fileType": "text/html", "fileSize": 6666, "uploadTime": "2022-04-14T01:51:36Z", "hash": "fed165e4dc0ed0xxbd3794e23972b8e9273c53c0df1d528xx02828297e36615", "status": 2 } ] }}
Failed Case Example
{ "ts": 1645088795, "code": 200, "error_code": 1003, "message": "[] is not an address", "data": null}
Response Specification
{ "ts": "response time (unix/second)", "code": "response code ( a value of 200 indicates that the request was successful)", "error_code": "there is an explanation at the bottom for error codes", "message": "error message", "data": "data"}
Special Note:
When the value of āerror_codeā is 0, āmessageā is an empty string, ādataā be null or can contain data;
When āerror_codeā is anything but 0, āerror_codeā corresponds to the error codes shown at the bottom,āmessageā column indicates that there has been an error, ādataā shows null.
Error Codes("error_code" column in Response)
Status code Instruction 0 Request has no error 1401 API Token has an error 1000 server error 1001 not_found 1002 Other errors 1003 Parameter error 1004 Network error 1005 Too frequent operations 1006 Mailbox format error 1012 Corresponding data not found 1013 API Token name duplicated 1014 API Token be no more than 20 1015 File upload failed 1019 File uploading 1020 User has no or insufficient storage space 1021 Request body is too large, note the maximum is 100M 1022 This area has been subscribed 1023 This is an empty file 1024 Keep at least one piece of data 1025 The current page number must be between [1, total pages] 1026 The number of data per page must be between [1,200]
#
Part II. API- File uploading
Intro
Users uploading files
HTTP Requests
Method: POST
Url: /v1/upload
Request Header
Parameters Data Type Description Special Note Token string Userās API Token - Content-Type string Content Type Please refer to the Content-Type on Request Parameters
Parameters Data type Required Default Description Special Note name string true NA File names( URL parameter, spliced after the URL address File name with a suffix file binary true NA File Stream File stream binary Response Data
Parameters Data Type Description Specification gateway string gateway - url string file accessing URL(fully connected) - reference string File hash - Common Content Type
Type Description Expamples text indicating that the file is a regular file, theoretically readable by human text/plain
,text/html
,text/css, text/javascript
image indicating that the conetnt is some kind of image; while video type is exculded by tis type, the image type applies to (include) dynamic pictures (e.g. gif) image/gif
,image/png
,image/jpeg
,image/bmp
,image/webp
,image/x-icon
,image/vnd.microsoft.icon
audio indicates that the conetnt is some kind of audio audio/midi
,audio/mpeg, audio/webm, audio/ogg, audio/wav
video indicates that the content is some kind of video video/webm
,video/ogg
application indicates that the content is s ome kind of binary data application/octet-stream
,application/pkcs12
,application/vnd.mspowerpoint
,application/xhtml+xml
,application/xml
,application/pdf
- File List
Intro
List of user uploaded files
HTTP Requests
Method: GET
Url: /v1/files
Request Header
Parameter Data Type Description Note Token string Userās API Token - Request Parameters
Parameter Data Type Required Default Description Special Note current num true 1 page number to redirected to Minimum page number is 1, do not exceed total page number size num true 20 Number of entries displayed per page Minimum number of entries per page is 1, maximum number of entries per page is 200 Response Data
Parameter Data Type Description Note current num current page - size num number of entries per page - total num total number of entries - totalPage num total page number - records list data collection - - id num File ID - - fileName string File name - - fileType string File Type - - fileSize num File size Unit is (byte) - uploadTime time upload time - - hash string file storage hash - - status num file upload status 1.uploading 2.upload succeeded 3.upload failed
- Deleting Files in batches
Intro
Deleting Files in batches
HTTP Requests
Method: GET
Url: /v1/delete_files
Request Header
Parameter Data Type Description Note Token string Userās API Token - Request Parameter
Parameter Data Type Required Default Description Special Note ids []num true NA File ID list Response Data
Parameter Data type Description Note - - - -