Documentation API
Dernière mise à jour : 6 Juillet 2019
General information
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.
{
"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"
}
Status Code | Response |
---|---|
200 | Everything is OK. Request succeeded |
400 | Bad request (e.g. wrong parameters) |
403 | Permission denied (wrong api login/key, action on a file which does not belong to you, …) |
404 | Video not found |
50x | Server errors. You should not see this, but be prepared. |
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
https://api.pstream.net/v1/account/info?login={login}&key={key}
Nom | Description | Example | Required |
---|---|---|---|
login | API-Login | ef48eg456bpfkcn | yes |
key | API-Key / API-Password | gkNivz4f8d9v_-CI | yes |
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
https://api.pstream.net/v1/file/info?file={file}&login={login}&key={key}
Nom | Description | Example | Required |
---|---|---|---|
file | Video-ID(s), single video or comma-separated (max. 50) | h4r8tn1f,Kpovpfm,F_-cneFK | yes |
login | API-Login | ef48eg456bpfkcn | yes |
key | API-Key / API-Password | gkNivz4f8d9v_-CI | yes |
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,
}
}
}
https://api.pstream.net/v1/file/getsplash?file={file}&login={login}&key={key}
Nom | Description | Example | Required |
---|---|---|---|
login | API-Login | ef48eg456bpfkcn | yes |
key | API-Key / API-Password | gkNivz4f8d9v_-CI | yes |
file | File-ID | Knvie_f9GWPF | yes |
200 (OK)
Content-Type: application/json
{
"status": 200,
"msg": "OK",
"result": "https://i.pstream.net/Knvie_f9GWPF/fneb48g4.jpg"
}
Upload
https://api.pstream.net/v1/file/ul?login={login}&key={key}&folder={folder}&sha1={sha1}&httponly={httponly}
Nom | 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 |
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
https://api.pstream.net/v1/remotedl/add?login={login}&key={key}&url={url}&folder={folder}&headers[]={headers}&headers[]={headers}
Nom | Description | Example | Required |
---|---|---|---|
login | API-Login | ef48eg456bpfkcn | yes |
key | API-Key / API-Password | gkNivz4f8d9v_-CI | yes |
url | Remote URL | https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_1080p_h264.mov | yes |
folder | Folder-ID to upload to | 1234 | no |
headers | additional HTTP headers (e.g. Cookies or HTTP Basic-Auth) as array querystring (e.g. headers[]=Cookie: abc;&headers[]=User-Agent: Firefox | User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/56.0 Cookie: auth=9898; | no |
200 (OK)
Content-Type: application/json
{
"status": 200,
"msg": "OK",
"result": {
"id": "12",
"folderid": "4248"
}
}
https://api.pstream.net/v1/remotedl/status?login={login}&key={key}&limit={limit}&id={id}
Nom | 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 |
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
}
}
}
Gestion des vidéos
https://api.pstream.net/v1/file/listfolder?login={login}&key={key}&folder={folder}
Nom | Description | Example | Required |
---|---|---|---|
login | API-Login | ef48eg456bpfkcn | yes |
key | API-Key / API-Password | gkNivz4f8d9v_-CI | yes |
folder | Folder-ID | 5 | no |
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"
}
]
}
}
https://api.pstream.net/v1/file/createfolder?login={login}&key={key}&pid={pid}&name={name}
Nom | Description | Example | Required |
---|---|---|---|
login | API-Login | ef48eg456bpfkcn | yes |
key | API-Key / API-Password | gkNivz4f8d9v_-CI | yes |
name | Name of new Folder | MyFolderBoi | yes |
pid | Parent Folder ID (if not set root folder will be used) | 12345 | no |
200 (OK)
Content-Type: application/json
{
"status": 200,
"msg": "OK",
"result": {
"folderid": 35678
}
}
https://api.pstream.net/v1/file/renamefolder?login={login}&key={key}&folder={folder}&name={name}
Nom | 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 |
200 (OK)
Content-Type: application/json
{
"status": 200,
"msg": "OK",
"result": true
}
Be very careful ! This will also delete all video in a folder !
https://api.pstream.net/v1/file/deletefolder?login={login}&key={key}&folder={folder}
Nom | Description | Example | Required |
---|---|---|---|
login | API-Login | ef48eg456bpfkcn | yes |
key | API-Key / API-Password | gkNivz4f8d9v_-CI | yes |
folder | Folder ID to delete | 12345 | yes |
200 (OK)
Content-Type: application/json
{
"status": 200,
"msg": "OK",
"result": true
}
https://api.pstream.net/v1/file/rename?login={login}&key={key}&file={file}&name={name}
Nom | 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 |
200 (OK)
Content-Type: application/json
{
"status": 200,
"msg": "OK",
"result": true
}
https://api.pstream.net/v1/file/move?login={login}&key={key}&file={file}&folder={folder}
Nom | 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 |
200 (OK)
Content-Type: application/json
{
"status": 200,
"msg": "OK",
"result": true
}
https://api.pstream.net/v1/file/delete?login={login}&key={key}&file={file}
Nom | Description | Example | Required |
---|---|---|---|
login | API-Login | ef48eg456bpfkcn | yes |
key | API-Key / API-Password | gkNivz4f8d9v_-CI | yes |
file | Video ID to delete | Ckfoe4_g8e1v5 | yes |
200 (OK)
Content-Type: application/json
{
"status": 200,
"msg": "OK",
"result": true
}
Encoding System
https://api.pstream.net/v1/file/converts?login={login}&key={key}&limit={limit}&id={id}
Nom | 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 |
file | Video ID | Gh_wKpe4f8v1 | no |
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"
}
]
}