Upload an app using the Kobiton API (Postman)

Learn how to use Postman to upload an app to the app repository using our REST API.

Before you start

Throughtout this document, replace https://api.kobiton.com with [http/https]://[Dell server IP or hostname]:3000 if you are using Standalone server.

Configure authorization in Postman

Most of the Kobiton API v2 endpoints requires Basic Authentication.

For the requests that require authorization in this document, do the following under the Authorization tab:

Authorization of Kobiton API request in Postman

Generate an upload URL

In Postman, create a new request with the POST method. This request requires authorization.

Under the Body tab, select raw, then choose the JSON format and input the following details:

{
    "file_name": "${app_file_name}",
    "app_id": ${app_id}
}

The request body has 2 parameters:

  • ${app_id}: (optional) Provide the app_id if another version of this app is already uploaded. Example: 100.

  • ${app_file_name}: (required) Name of the app file to upload. Example: MyApp.ipa.

You can look up the app_id in app metadata.

We will use the app MyApp.ipa throughout this guide to demonstrate the upload process. Assuming this app does not exist in the repository, there is no need to specify an app_id in the request body:

{
    "file_name": "MyApp.ipa"
}

Below is an example of how the request would look like in Postman:

Generate an upload URL request body

Click Send to send the request. A successful response will return the following:

Example
{
    "app_path": "users/1/apps/MyApp‐237824a0‐302c‐9bfd‐ff417c89610a.ipa",
    "url": "https://kobiton-us-west.s3.amazonaws.com/users/78042/apps/MyApp-57b15160-cf17-11ee-98d5-e949a34321c7f.ipa?AWSAccessKeyId=AKIAYOIAYUIRGDSFS6QO&Content-Type=application%2Foctet-stream&Expires=1708384165&Signature=VHTRqXdIpKmbvauPsdfsKJhAgk%3D&x-amz-acl=private&x-amz-meta-appid=600841&x-amz-meta-createdby=78042&x-amz-meta-organizationid=681&x-amz-tagging=unsaved%3Dtrue"
}

Save the above values for the next sections.

Upload app file to S3 storage

Create a new request with PUT method.

For URL, input the url from the response from the previous section. Following the example, the url would be:

https://kobiton-us-west.s3.amazonaws.com/users/78042/apps/MyApp-57b15160-cf17-11ee-98d5-e949a34321c7f.ipa?AWSAccessKeyId=AKIAYOIAYUIRGDSFS6QO&Content-Type=application%2Foctet-stream&Expires=1708384165&Signature=VHTRqXdIpKmbvauPsdfsKJhAgk%3D&x-amz-acl=private&x-amz-meta-appid=600841&x-amz-meta-createdby=78042&x-amz-meta-organizationid=681&x-amz-tagging=unsaved%3Dtrue

Under the Authorization tab, select No Auth for Type, since this endpoint does not require any authorization.

Set authorization type as No Auth

Under the Header tab, add the following key and value pairs:

Key Value

x-amz-tagging

unsaved=true

Content-Type

application/octet-stream

Add header key and value pairs

Under the Body tab, select binary, then Select file. Choose the app package file you want to upload.

Select binary file to upload in the request body

Click Send. A blank response and Status: 200 OK indicates a successful upload.

Create the app or app version in the app repository

In Postman, create a new request with POST method. This request requires authorization.

In the Header tab, remove the x-amz-tagging and Content-Type from the previous request (Upload app file to S3 storage) if they exist.

Under the Body tab, select raw, then choose the JSON format and input the following details:

{
    "file_name": "${app_file_name}",
    "app_path": "${app_path}"
}

The request body contains 2 parameters:

  • ${app_path}: (required) Use the value of app_path from the previous step.

  • ${app_file_name}: (optional) Specify the name of the app. If not provided, the name of the file from ${app_path} is used.

Continuing on from the previous steps, the request body would be:

{
    "file_name": "MyApp.ipa",
    "app_path": "users/1/apps/MyApp‐237824a0‐302c‐9bfd‐ff417c89610a.ipa"
}

Below is an example of how the request would look like in Postman:

Request body of the create app or app version api

Click Send. If your request was successful, POST will return a 200 status with the following response:

{
  "app_id": 100,
  "version_id": 101
}

In the response above, app_id is the ID of the new app, and version_id is the ID of the new application version.

If the app file is too large, it may take a while to process the file and the value of app_id will be N/A. See the next section on how to obtain the app_id.

Obtain the app ID

In Postman, create a new request with GET method. This request requires authorization.

Provide in the URL above the version_id obtained from the previous step. Continuing on with the example, the URL would be:

https://api.kobiton.com/v2/apps/parsing-status?appVersionId=101

Below is an example of how the request would look like in Postman:

Get app parsing status request body

Click Send. If your request was successful, GET will return a 200 status with the following response:

{
"app_id": 100,
"state": "OK"
}

The response has 2 parameters:

  • state: indicates the parsing status of the app.

    • OK: The uploaded application is processed by the server and is ready to use.

    • PARSING: The server is still processing the uploaded application.

    • FAILURE_PARSING: The server could not process the uploaded application, typically due to an invalid file type.

  • app_id: the ID of the app to use in other endpoints such as installing the app on a device or get information about a specific app.

If you receive error 404 with the message App version ID …​ doesn’t exist, the application version might be made inaccessible to your account. Contact an admin for access.

Troubleshooting

Create the app or app version request failed with status 400

Error 400 from sending create app or app version request

  • Cause: The x-amz-tagging and Content-Type headers from the previous request (Upload app file to S3 storage) are not removed.

  • Solution: In the Header tab of the request, remove x-amz-tagging and Content-Type, then send the request again.