Skip to content

Instantly share code, notes, and snippets.

package org.wso2.ballerina.sample.hello;
import ballerina.lang.system;
function main(string[] args) {
system:println("Hello, World!");
}
import ballerina.lang.system;
function main(string[] args) {
system:println("Hello, World!");
}

You can use the REST APIs provided with WSO2 EMM 2.2.0 to publish an App programmatically. Refer the below steps.

  1. First you need to generate an access token. You can refer the [1] for that.
    Sample Request
    curl -k -H "Content-Type: application/json" -X POST -d '{"owner":"admin","clientName":"admin_emm","grantType":"refresh_token password client_credentials","tokenScope":"prod"}' https://localhost:9443/dynamic-client-web/register
    
    Sample Response
  2. Encode the <CLIENT_ID>:<CLIENT_SECRET> using base64 encoder
curl -X POST -H “Authorization: Bearer 352c94d3-b47b-3898-b3ef-70b2d4581c38” -H “Content-Type: multipart/form-data” -F “file=@VTV.apk” “http://localhost:9763/api/appm/publisher/v1.1/apps/mobile/binaries"
{“scope”:”default”,”token_type”:”Bearer”,”expires_in”:3600,”refresh_token”:”c765130a-9efd-3920-a002-ec9e0baa175c”,”access_token”:”352c94d3-b47b-3898-b3ef-70b2d4581c38"}
curl -k -d “grant_type=password&username=admin&password=admin&scope=default “ -H “Authorization: Basic VWRURDYyeGthZHBod2RiSHJVZkVGV2J1eDhjYTpZWHp2djg4Z2lKZ2tCYU51SWtXTG9zcTc2U0Fh” -H “Content-Type: application/x-www-form-urlencoded” https://localhost:9443/oauth2/token
{“client_secret”:”YXzvv88giJgkBaNuIkWLosq76SAa”,”callback_url”:null,”client_id”:”UdTD62xkadphwdbHrUfEFWbux8ca”,”client_name”:”admin_admin_emm”}
curl -k -H “Content-Type: application/json” -X POST -d ‘{“owner”:”admin”,”clientName”:”admin_emm”,”grantType”:”refresh_token password client_credentials”,”tokenScope”:”prod”}’ https://localhost:9443/dynamic-client-web/register
@thusithathilina
thusithathilina / pom.xml
Created October 4, 2016 08:54
pom to create msf4j product with stockquote feature
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.sample</groupId>
<artifactId>sample-feature-installation</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<name>New feature</name>
<feature>
<id>org.wso2.msf4j.stockquote.feature.group</id>
<version>${msf4j.version}</version>
</feature>