Cp

Ne Xpush

1.  Overview

neXpush is a simple API where developers can deploy their applications to neXva's content provider back office.

The goal of neXpush was to be intuitive and powerful enough so that almost every aspect of deploying your app to neXva can be driven via the API and closely integrated into the app developer's own build/deployment process.

2.  Method of Operation

1. A provisioning archive (a ZIP file) is created with the builds and other image resources (such as thumbnails, screenshots) with a single XML file named provision.xml in its root. The XML file will describe meta details of the build/s (title, descriptions, price, compatible devices etc).

2. The provisioning archive is submitted to neXva via a HTTP API endpoint using the developer's Content Provider (CP) credentials.

3.  The Provisioning Archive (PA)

The PA is a ZIP file with the build binaries and image resources associated with them in their own directories. For example:

The name or the directory structure within the PA does not matter as long as they are described in the provision.xml file.

4.  The provision.xml file

You can download a sample provision.xml with inline comments that describes the element and their properties in detail.

neXva provides a publicly available Document Definition Type (DTD) which will help you validate your XML and verify that it is correct. You must ensure that the provision.xml file passes validation before submitting to neXpush.

5.  Submitting your provisioning archive to neXpush

5.1  API endpoint

The API endpoint to submit your file is located at: https://api.nexva.com/nexpush/submit

5.2  Authentication

The API expects that you authenticate via HTTP basic access authentication over SSL. The username is the email you used to signup for your CP account along with your password.

e.g.

https://johndoe@foobar.com:mysecretpassword@api.nexva.com/nexpush/submit

5.3  HTTP POST details

The endpoint expects a HTTP POST with the provision file encoded in the request. The HTTP POST request must contain a single field named 'provision' which contains the encoded provisioning archive.

5.4  Response codes

The responses will always return in JSON format.

e.g:

{"status":1,"message":"Your content was provisioned successfully"}

On success, the status shall always be "1". A status of '0' would mean something went wrong and 'message' would have more information that would help you find out why.

5.5  Sample code

The sample code written in PHP below demonstrate a scenario where a provisioning archive is submitted to neXpush


    $ch = curl_init();
    $username = urlencode('johndoe@foobar.com');
    $password = urlencode('secret');

    curl_setopt($ch, CURLOPT_URL, "https://$username:$password@api.nexva.com/nexpush/submit");
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_VERBOSE, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
    curl_setopt($ch, CURLOPT_POST, true);
    $post = array(
        "provision" => "@/home/jdoe/files/app_provision/provision.zip"
    );
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
    $response = curl_exec($ch);

    if( $response === false ) die("Error uploading file: ".curl_error ( $ch ) );