Skip to main content

HTTP API

Part I. Basic Instructions#

  • Domain:

    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 codeInstruction
    0Request has no error
    1401API Token has an error
    1000server error
    1001not_found
    1002Other errors
    1003Parameter error
    1004Network error
    1005Too frequent operations
    1006Mailbox format error
    1012Corresponding data not found
    1013API Token name duplicated
    1014API Token be no more than 20
    1015File upload failed
    1019File uploading
    1020User has no or insufficient storage space
    1021Request body is too large, note the maximum is 100M
    1022This area has been subscribed
    1023This is an empty file
    1024Keep at least one piece of data
    1025The current page number must be between [1, total pages]
    1026The number of data per page must be between [1,200]

Part II. API#

  1. File uploading
  • Intro

    Users uploading files

  • HTTP Requests

    Method: POST

    Url: /v1/upload

  • Request Header

    ParametersData TypeDescriptionSpecial Note
    TokenstringUserā€™s API Token-
    Content-TypestringContent TypePlease refer to the Content-Type on
  • Request Parameters

    ParametersData typeRequiredDefaultDescriptionSpecial Note
    namestringtrueNAFile names( URL parameter, spliced after the URL addressFile name with a suffix
    filebinarytrueNAFile StreamFile stream binary
  • Response Data

    ParametersData TypeDescriptionSpecification
    gatewaystringgateway-
    urlstringfile accessing URL(fully connected)-
    referencestringFile hash-
  • Common Content Type

    TypeDescriptionExpamples
    textindicating that the file is a regular file, theoretically readable by humantext/plain, text/html, text/css, text/javascript
    imageindicating 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
    audioindicates that the conetnt is some kind of audioaudio/midi, audio/mpeg, audio/webm, audio/ogg, audio/wav
    videoindicates that the content is some kind of videovideo/webm, video/ogg
    applicationindicates that the content is s ome kind of binary dataapplication/octet-stream, application/pkcs12, application/vnd.mspowerpoint, application/xhtml+xml, application/xml, application/pdf
  1. File List
  • Intro

    List of user uploaded files

  • HTTP Requests

    Method: GET

    Url: /v1/files

  • Request Header

    ParameterData TypeDescriptionNote
    TokenstringUserā€™s API Token-
  • Request Parameters

    ParameterData TypeRequiredDefaultDescriptionSpecial Note
    currentnumtrue1page number to redirected toMinimum page number is 1, do not exceed total page number
    sizenumtrue20Number of entries displayed per pageMinimum number of entries per page is 1, maximum number of entries per page is 200
  • Response Data

    ParameterData TypeDescriptionNote
    currentnumcurrent page-
    sizenumnumber of entries per page-
    totalnumtotal number of entries-
    totalPagenumtotal page number-
    recordslistdata collection-
    - idnumFile ID-
    - fileNamestringFile name-
    - fileTypestringFile Type-
    - fileSizenumFile sizeUnit is (byte)
    - uploadTimetimeupload time-
    - hashstringfile storage hash-
    - statusnumfile upload status1.uploading 2.upload succeeded 3.upload failed
  1. Deleting Files in batches
  • Intro

    Deleting Files in batches

  • HTTP Requests

    Method: GET

    Url: /v1/delete_files

  • Request Header

    ParameterData TypeDescriptionNote
    TokenstringUserā€™s API Token-
  • Request Parameter

    ParameterData TypeRequiredDefaultDescriptionSpecial Note
    ids[]numtrueNAFile ID list
  • Response Data

    ParameterData typeDescriptionNote
    ----