API Documentation

Last updated: 6 July, 2019

General information

API calls Syntax

Base-URL for our API is https://api.pstream.net/v1 (note the v1 for version 1 behind the /)
All requests to the API shall be HTTP GET or POST

Most requests require a API Login & API Key, you can find both in the User Panel.

Please make sure to use the API with HTTPS only.

Responses are in JSON, structure is as follows:
{
     "status": "status-code",
     "msg": "informational message. might vary, use the status code in your code!",
     "result": "result of the request. varies depending on the request"
}
API status responses
Status CodeResponse
200Everything is OK. Request succeeded
400Bad request (e.g. wrong parameters)
403Permission denied (wrong api login/key, action on a file which does not belong to you, …)
404Video not found
50xServer errors. You should not see this, but be prepared.
API message and results
Key # Text
msg This message gives more detailed information in case there is an error. You can use this for displaying it to the user, but please don’t use it for checking if the request succeeded. That’s what the status code is for.
result holds the response of the request if succeeded. Might hold an array of data or just a boolean true/false, depending on the request

Account

Account information
Request

https://api.pstream.net/v1/account/info?login={login}&key={key}

Parameters
Name Description Example Required
login API-Login ef48eg456bpfkcn yes
key API-Key / API-Password gkNivz4f8d9v_-CI yes
Response
200 (OK)
Content-Type: application/json
{
    "status": 200,
    "msg": "OK",
    "result": {
        "extid": "fnvjeof4815f",
        "email": "pascal@pstream.net",
        "signup_at": "2018-01-07 17:59:31"
    }
}

Video

Check video information
Request
https://api.pstream.net/v1/file/info?file={file}&login={login}&key={key}
Parameters
NameDescriptionExampleRequired
fileVideo-ID(s), single video or comma-separated (max. 50)h4r8tn1f,Kpovpfm,F_-cneFKyes
loginAPI-Loginef48eg456bpfkcnyes
keyAPI-Key / API-PasswordgkNivz4f8d9v_-CIyes
Response
200 (OK)
Content-Type: application/json
{
    "status": 200,
    "msg": "OK",
    "result": {
        "72fA-_Lq8Ak3": {
            "id": "72fA-_Lq8Ak3",
            "status": 200,
            "name": "The quick brown fox.mp4",
            "size": 123456789012,
            "sha1": "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12",
            "content_type": "video/mp4",
        },
        "72fA-_Lq8Ak4": {
            "id": "72fA-_Lq8Ak4",
            "status": 500,
            "name": "The quick brown fox.mp4",
            "size": false,
            "sha1": "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12",
            "content_type": "video/mp4",
        },
        "72fA-_Lq8Ak5": {
            "id": "72fA-_Lq8Ak5",
            "status": 404,
            "name": false,
            "size": false,
            "sha1": false,
            "content_type": false,
        }
    }
}
Get thumbnail image
Request

https://api.pstream.net/v1/file/getsplash?file={file}&login={login}&key={key}

Parameters
NameDescriptionExampleRequired
loginAPI-Loginef48eg456bpfkcnyes
keyAPI-Key / API-PasswordgkNivz4f8d9v_-CIyes
fileFile-IDKnvie_f9GWPFyes
Response
200 (OK)
Content-Type: application/json
{
    "status": 200,
    "msg": "OK",
    "result": "https://i.pstream.net/Knvie_f9GWPF/fneb48g4.jpg"
}

Upload

Start upload
Request

https://api.pstream.net/v1/file/ul?login={login}&key={key}&folder={folder}&sha1={sha1}&httponly={httponly}

Parameters
Name Description Example Required
login API-Login ef48eg456bpfkcn yes
key API-Key / API-Password gkNivz4f8d9v_-CI yes
folder Folder-ID to upload to 5151 no
sha1 Expected sha1 If sha1 of uploaded file doesn’t match this value, upload fails 7ee4e1c67a2db8fced849ee1bb76e7391b93eb12 no
httponly If this is set to true, use only http upload links false no
Response
200 (OK)
Content-Type: application/json
{
    "status": 200,
    "msg": "OK",
    "result": {
        "url": "https://1n8rg48c.example.com/ul/fCgaPthr_ys",
        "valid_until": "2018-01-09 13:02:00"
    }
}

Remote Uploads

Add a remote upload job
Request

https://api.pstream.net/v1/remotedl/add?login={login}&key={key}&url={url}&folder={folder}&headers[]={headers}&headers[]={headers}

Parameters
NameDescriptionExampleRequired
loginAPI-Loginef48eg456bpfkcnyes
keyAPI-Key / API-PasswordgkNivz4f8d9v_-CIyes
urlRemote URLhttps://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_1080p_h264.movyes
folderFolder-ID to upload to1234no
headersadditional HTTP headers (e.g. Cookies or HTTP Basic-Auth) as array querystring (e.g. headers[]=Cookie: abc;&headers[]=User-Agent: FirefoxUser-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/56.0
Cookie: auth=9898;
no
Response
200 (OK)
Content-Type: application/json
{
    "status": 200,
    "msg": "OK",
    "result": {
        "id": "12",
        "folderid": "4248"
    }
}
Check status of remotes uploads job
Request
https://api.pstream.net/v1/remotedl/status?login={login}&key={key}&limit={limit}&id={id}
Parameters
Name Description Example Required
login API-Login ef48eg456bpfkcn yes
key API-Key / API-Password gkNivz4f8d9v_-CI yes
limit Maximum number of results (Default: 5, Maximum: 100) 5 no
id Remote Upload ID 5656 no
Response
200 (OK)
Content-Type: application/json
{
    "status": 200,
    "msg": "OK",
    "result": {
        "24": {
            "id": 24,
            "remoteurl": "https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_1080p_h264.mov",
            "status": "new",
            "progress_percent": null
            "folderid": "4248",
            "added": "2018-02-21 09:20:26",
            "last_update": "2018-02-21 09:20:26",
            "errormsg": false,
            "extid": false,
            "url": false
        },
        "22": {
            "id": 22,
            "remoteurl": "https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_h264.mov",
            "status": "downloading",
            "progress_percent": "78.41",
            "folderid": "4248",
            "added": "2018-02-21 09:20:26",
            "last_update": "2018-02-21 09:21:56",
            "errormsg": false,
            "extid": false,
            "url": false
        },
        "20": {
            "id": 20,
            "remoteurl": "https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_480p_h264.mov",
            "status": "finished",
            "progress_percent": "100",
            "folderid": "4248",
            "added": "2018-02-21 09:03:47",
            "last_update": "2018-02-21 09:04:04",
            "errormsg": false,
            "extid": "ANAaeBZus-Q",
            "url": "https://www.pstream.net/v/ANAaeBZus-Q"
        },
        "3": {
            "id": 3,
            "remoteurl": "http://127.0.0.1/",
            "status": "error",
            "progress_percent": "100",
            "folderid": "4",
            "added": "2018-02-17 18:58:11",
            "last_update": "2018-02-19 18:07:45",
            "errormsg": "Invalid URL",
            "extid": false,
            "url": false
        }
    }
}

Video Management

List Videos and Folders
Request
https://api.pstream.net/v1/file/listfolder?login={login}&key={key}&folder={folder}
Parameters
Name Description Example Required
login API-Login ef48eg456bpfkcn yes
key API-Key / API-Password gkNivz4f8d9v_-CI yes
folder Folder-ID 5 no
Response
200 (OK)
Content-Type: application/json
{
    "status": 200,
    "msg": "OK",
    "result": {
        "folders": [
            {
                "id": "456",
                "name": "My Great Folder"
            },
            {
                "id": "789",
                "name": "Other Folder"
            }
        ],
        "files": [
            "VKrJd-A_vNmpP4L": {
                "name": "Big bunny buck 720p",
                "sha1": "8fd4e1c67a2d28fced849ee1bb76e7391b93eb12",
                "folder_id": 0,
                "upload_at": 1532854309,
                "status": "active",
                "size": 193986560,
                "content_type": "video/mp4",
                "cstatus": "ok",
                "link": "https://www.pstream.net/v/VKrJd-A_vNmpP4L",
                "embed_link": "https://www.pstream.net/e/VKrJd-A_vNmpP4L",
                "linkextid": "VKrJd-A_vNmpP4L"
            },
            "C4f9cApMlcnJQ": {
                "name": "Big bunny buck 1080p",
                "sha1": "8fd4e1c67a2d28fced849ee1bb76e7391b93eb12",
                "folder_id": 789,
                "upload_at": 1532854309,
                "status": "suspended",
                "size": 354418688,
                "content_type": "video/mp4",
                "cstatus": "ok",
                "link": "https://www.pstream.net/v/C4f9cApMlcnJQ",
                "embed_link": "https://www.pstream.net/e/C4f9cApMlcnJQ",
                "linkextid": "C4f9cApMlcnJQ"
            }
        ]
    }
}
Create Folder
Request
https://api.pstream.net/v1/file/createfolder?login={login}&key={key}&pid={pid}&name={name}
Parameters
NameDescriptionExampleRequired
loginAPI-Loginef48eg456bpfkcnyes
keyAPI-Key / API-PasswordgkNivz4f8d9v_-CIyes
nameName of new FolderMyFolderBoiyes
pidParent Folder ID (if not set root folder will be used)12345no
Response
200 (OK)
Content-Type: application/json
{
    "status": 200,
    "msg": "OK",
    "result": {
        "folderid": 35678
    }
}
Rename Folder
Request
https://api.pstream.net/v1/file/renamefolder?login={login}&key={key}&folder={folder}&name={name}
Parameters
Name Description Example Required
login API-Login ef48eg456bpfkcn yes
key API-Key / API-Password gkNivz4f8d9v_-CI yes
folder Folder ID to rename 12345 yes
name New name MyRenamedFolder yes
Response
200 (OK)
Content-Type: application/json
{
    "status": 200,
    "msg": "OK",
    "result": true
}
Delete Folder

Be very careful ! This will also delete all video in a folder !

Request
https://api.pstream.net/v1/file/deletefolder?login={login}&key={key}&folder={folder}
Parameters
Name Description Example Required
login API-Login ef48eg456bpfkcn yes
key API-Key / API-Password gkNivz4f8d9v_-CI yes
folder Folder ID to delete 12345 yes
Response
200 (OK)
Content-Type: application/json
{
    "status": 200,
    "msg": "OK",
    "result": true
}
Rename Video
Request
https://api.pstream.net/v1/file/rename?login={login}&key={key}&file={file}&name={name}
Parameters
Name Description Example Required
login API-Login ef48eg456bpfkcn yes
key API-Key / API-Password gkNivz4f8d9v_-CI yes
file Video ID to rename bPmLf4e81_FE yes
name New name My Renamed Video yes
Response
200 (OK)
Content-Type: application/json
{
    "status": 200,
    "msg": "OK",
    "result": true
}
Move Video
Request
https://api.pstream.net/v1/file/move?login={login}&key={key}&file={file}&folder={folder}
Parameters
Name Description Example Required
login API-Login ef48eg456bpfkcn yes
key API-Key / API-Password gkNivz4f8d9v_-CI yes
file Video ID to move Ckfoe4_g8e1v5 yes
folder Folder ID target 15484 yes
Response
200 (OK)
Content-Type: application/json
{
    "status": 200,
    "msg": "OK",
    "result": true
}
Delete Video
Request
https://api.pstream.net/v1/file/delete?login={login}&key={key}&file={file}
Parameters
Name Description Example Required
login API-Login ef48eg456bpfkcn yes
key API-Key / API-Password gkNivz4f8d9v_-CI yes
file Video ID to delete Ckfoe4_g8e1v5 yes
Response
200 (OK)
Content-Type: application/json
{
    "status": 200,
    "msg": "OK",
    "result": true
}

Encoding System

Check encoding status of video
Request

https://api.pstream.net/v1/file/converts?login={login}&key={key}&limit={limit}&id={id}

Parameters
NameDescriptionExampleRequired
loginAPI-Loginef48eg456bpfkcnyes
keyAPI-Key / API-PasswordgkNivz4f8d9v_-CIyes
limitMaximum number of results (Default: 5, Maximum: 100)5no
fileVideo IDGh_wKpe4f8v1no
Response
200 (OK)
Content-Type: application/json
{
    "status": 200,
    "msg": "OK",
    "result": [
        {
            "name": "MyOldCamera.avi",
            "id": "451984984",
            "status": "pending",
            "last_update": "2019-01-01 04:40:40",
            "progress": 57,
            "retries": "0",
            "link": "https://www.pstream.net/v/LbVwPmA47",
            "linkextid": "LbVwPmA47"
        }
    ]
}