How to upload apps into KOBITON by using POSTMAN - Kobiton

How to upload apps into KOBITON by using POSTMAN

How to upload apps into KOBITON by using POSTMAN

Kobiton has long supported the ability for end-users to upload their apps to the Kobiton App Repository, either via the UI or via the REST API. It is intended to help users manage new and existing versions of their applications within the Kobiton cloud. Users can add any number of apps to the App Repository and also create restricted access if necessary. Today, I would like to introduce another way to upload apps into Apps Repo using Postman.

Create Environment

We need to create some variables on Postman to reuse those on our requests. There are some required variables username, apiKey, host, and filename. For examples:

  • username: joeybrown
  • apiKey: 3bfd8955-e252-4754-bffd-beb057b2b849
  • host: https://api.kobiton.com
  • filename: /Users/joeybrown/Downloads/ApiDemos-debug.apk

Upload Apps

Generate Upload URL

  1. On the Params tab, create a POST request with URL = {{host}}/v1/apps/uploadUrl
  2. On the Authorizarion tab, choose Type = Basic Auth
    • Username = {{username}}
    • Password = {{apiKey}}
  3. On the Headers tab, add Content-Type = application/json
  4. On the Body tab, switch to raw data with JSON format.
    • The file data is
{
"filename" :"{{filename}}",
"appPath" : "{{appPath}}"
}

5. On Tests tab, we will parse the response data and set appPath and appUrl as variables with three lines below:

var data = JSON.parse(responseBody);

postman.setEnvironmentVariable("appPath", data.appPath);

postman.setEnvironmentVariable("appUrl", data.url);

After that, we click the Send button to send the request to the Kobiton server. The output looks like below. The appPath and url are saved to the variables.

Upload File To S3

  1. Create PUT request with URL = {{appURL}}
  2. On the Headers tab, add Content-Type = application/json and x-amz-tagging = unsaved=true
  3. On the Body tab, browse to the file that we want to upload (ApiDemos-debug.apk)
  4. Then click the Send button, the response status code 200 will be returned.

Create Application Or Version

  1. Create POST request with URL = {{host}}/v1/apps
  2. On the Authorizarion tab, choose Type = Basic Auth
    • Username = {{username}}
    • Password = {{apiKey}}
  3. On the Body tab, switch to raw data with JSON format.
{
"filename" :"{{filename}}",
"appPath" : "{{appPath}}"
}

4. Then click the Send button, the appId and versionId are returned.

We can double-check by accessing https://portal.kobiton.com/apps and filter the appId.

Tags:
No Comments

Post A Comment