Orbitvu Public Support Site

Downloads list

Updated on

Downloads API returns the list of downloads prepared by users on the specific account:

URL: https://orbitvu.co/api/v1/downloads [.json|.xml]

Method: GET

Returned value:

{
    "count": 2,
    "next": null,
    "previous": null,
    "results": [
        {
            "created_at": "2018-08-08T14:54:57",
            "file_name": "kNYSKJPWkwqmyx66Dug3PU.zip",
            "complete": true,
            "viewer": "ORBITVU VIEWER My360",
            "presentations": [
                "xyzxyzxyzxyzxyzXYZ1233"
            ],
            "url": "https://orbitvu.co/api/v1/downloads/1",
            "download_url": "https://orbitvu.co/api/v1/downloads/1/download",
            "user_email": "[email protected]",
            "user_url": "https://orbitvu.co/api/v1/account/users/1"
        },
        {
            "created_at": "2018-08-08T11:44:30",
            "file_name": "jqYpnFNsjKuok22XGrFx4G.zip",
            "complete": true,
            "viewer": "ORBITVU VIEWER Free360",
            "presentations": [
                "xyzxyzxyzxyzxyzXYZ1234",
                "xyzxyzxyzxyzxyzXYZ1235",
                "xyzxyzxyzxyzxyzXYZ1236",
                "xyzxyzxyzxyzxyzXYZ1237"
            ],
            "url": "https://orbitvu.co/api/v1/downloads/2",
            "download_url": "https://orbitvu.co/api/v1/downloads/2/download",
            "user_email": "[email protected]",
            "user_url": "https://orbitvu.co/api/v1/account/users/2"
        }]
}

Searching

  • exact
    Search by completion status or by presentation UID
    # match downloads that are completed
    https://orbitvu.co/api/v1/downloads.json?complete=true
    
    # match downloads that are not yet completed
    https://orbitvu.co/api/v1/downloads.json?complete=false
    
    # match downloads containing presentation with uid xyzxyzxyzxyzxyzXYZ1235
    https://orbitvu.co/api/v1/downloads.json?uid=xyzxyzxyzxyzxyzXYZ1235

Ordering

Order by: created_at, complete

# ascending
https://orbitvu.co/api/v1/downloads/?ordering=created_at
https://orbitvu.co/api/v1/downloads/?ordering=complete

# descending
https://orbitvu.co/api/v1/downoads/?ordering=-created_at
https://orbitvu.co/api/v1/downloads/?ordering=-complete

Create new download

Initializes creation of the new Download object. Download object consists of a presentation(s), Orbitvu Viewer and HTML files.

URL: https://orbitvu.co/api/v1/downloads [.json|.xml]

Method: POST

Parameters:

  • viewer_license_id - required; id of the Orbitvu Viewer to be downloaded with presentation(s) (can be taken from the viewers API endpoint)
  • presentation_ids - required; ids of the presentations to be downloaded
  • format_flat - 1 or 0 - archive format
  • extra_emails - comma-separated list of e-mail addresses that will receive a download link

Returned values:

id - download id

message - message

status - OK | ERROR


Sample (Python) code:

import requests
requests.post(
    'https://orbitvu.co/api/v1/downloads.json',
    data={'viewer_license_id': 1, 'presentation_ids': [1, 2]},
    headers={'Authorization': 'token xxxxxxxxxxxxxxxxxxxx'})

Sample PHP code:

<?php
define("API_KEY", "YOUR API KEY"); 
function callApi($request, $params = [], $method = 'get', $data = "") {
    $request = $request.".json"; //set the json mode always
    
    /* Set the access token */
    $header = array();
    $header[] = "Authorization: Token ".API_KEY;
    if (is_array($params) && $params) {
        $request .= "?".http_build_query($params);
    }
    $c = curl_init();
    curl_setopt($c, CURLOPT_SSL_VERIFYPEER, true);
    curl_setopt($c, CURLOPT_URL, $request);
    curl_setopt($c, CURLOPT_HTTPHEADER, $header);
    curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 10);
    curl_setopt($c, CURLOPT_TIMEOUT, 20);
    curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
    if ('post' == strtolower($method)) {
        curl_setopt($c, CURLOPT_POST, strlen($data));
        curl_setopt($c, CURLOPT_POSTFIELDS, $data);
    }
    $response = curl_exec($c);
    return json_decode($response, true); 
}


/******************************/ 
/* SAMPLE REQUESTS TO THE API */
/******************************/
// GET PRESENTATIONS LIST AND LIMIT RESULT TO THE 5 AND SORT THEM BY SKU ASCENDING 
$presentations = callApi("https://orbitvu.co/api/v1/presentations", ['page_size' => 5, 'ordering' => 'sku']); 

// GET VIEWER LICENSES
$viewerLicenses = callApi("https://orbitvu.co/api/v1/account/viewers");
if ($viewerLicenses && $presentations['results']) {
    // choose first presentation to download
    $prToDownload = $presentations['results'][1]; 
    // choose another presentation to download
    $prToDownload2 = $presentations['results'][4]; 
    // choose some viewer license
    $vLicense = $viewerLicenses[0];  
    // set request data
    $data =  "viewer_license_id=".$vLicense['id']."&presentation_ids=".$prToDownload['id']."&presentation_ids=".$prToDownload2['id'];

    // generate downloads
    $download = callApi("https://orbitvu.co/api/v1/downloads", [], 'post', $data); 
}

Download details

Returns details of specific Download

URL: https://orbitvu.co/api/v1/downloads/<id>/ [.json|.xml]

Method: GET

Sample data returned:

{
    "created_at": "2018-08-08T11:44:30",
    "file_name": "jqYpnFNsjKuok22XGrFx4G.zip",
    "complete": true,
    "viewer": "ORBITVU VIEWER Free360",
    "presentations": [
        "xyzxyzxyzxyzxyzXYZ1234",
        "xyzxyzxyzxyzxyzXYZ1235",
        "xyzxyzxyzxyzxyzXYZ1236",
        "xyzxyzxyzxyzxyzXYZ1237"
    ],
    "url": "https://orbitvu.co/api/v1/downloads/2",
    "download_url": "https://orbitvu.co/api/v1/downloads/2/download",
    "user_email": "[email protected]",
    "user_url": "https://orbitvu.co/api/v1/account/users/2"
}


Delete download

Delete specific Download object identified by id

URL: https://orbitvu.co/api/v1/downloads/<id>/ [.json|.xml]

Method: DELETE

Returned code: 204 (no content)

Sample Python code:

import requests
requests.delete('https://orbitvu.co/api/v1/downloads/1/.json', headers={'Authorization': 'token xxxxxxxxxxxxxxxxxxxxxx'})

Still Need Help? Contact Us