2. Configuration and Usage

2.1. Change authentication method

To use Sipwise C5 subscribers as authentication against the API, you need to set it in the comx-fileshare-service config.js:

simpleUpload: {
  authentication: {
    enabled: true,
    subscriber: true,
    username: 'foo8',
    password: 'bar8'
  }
}

You can now authenticate like this with the API:

curl -i -X POST --insecure --form file=@/tmp/test.txt --user '43991002@domain.tld:x43991002' \
    https://$NGCP_IP:1446/rtc/fileshare/uploads

If you want to use the credentials from the config.js you need so set it to the following settings:

simpleUpload: {
  authentication: {
    enabled: true,
    subscriber: false,
    username: 'foo8',
    password: 'bar8'
  }
}

In this case, the login parameter would be this:

curl -i -X POST --insecure --form file=@/tmp/test.txt --user 'foo8:bar8' \
    https://$NGCP_IP:1446/rtc/fileshare/uploads

2.2. Database Structure

Table information for the fileshare database:

  • downloads table:

    Table E.1. Details of downloads Table in fileshare Database

    Field Name Field Type Description

    id

    CHAR, PRIMARY KEY

    Internal ID of the download action

    state

    ENUM

    State of the download

    uploaded_id

    CHAR, FOREIGN KEY

    External ID used for accessing the uploaded file in uploads table

    created_at

    DATETIME

    Download action creation time

    updated_at

    DATETIME

    Time of last download action modification


  • sessions table:

    Table E.2. Details of sessions Table in fileshare Database

    Field Name Field Type Description

    id

    CHAR, PRIMARY KEY

    Internal ID of the session

    ttl

    INT

    Time-to-live value of the session (in seconds)

    created_at

    DATETIME

    Session creation time

    updated_at

    DATETIME

    Time of last session modification


  • uploads table:

    Table E.3. Details of uploads Table in fileshare Database

    Field Name Field Type Description

    id

    CHAR, PRIMARY KEY

    Internal ID of the file entry

    data

    LONGBLOB

    The file data

    original_name

    VARCHAR

    Original name of the file

    mime_type

    VARCHAR

    MIME type of the file

    size

    INT

    File size in bytes

    ttl

    INT

    Time-to-live value of the file

    state

    ENUM

    State of the file

    session_id

    CHAR, FOREIGN KEY

    External ID used to access session data in sessions table

    created_at

    DATETIME

    File creation / upload time

    updated_at

    DATETIME

    Time of last file modification