Hi, Below are the new Metadata APIs currently finished implemented. Oauth is the only authentication mechanism in medatadata api. There is no username password base authentication in metadata API since users are not meant to interact with the metadata API. An JWT <http://jwt.io/> token is generated per application and sent to the instances in payload. So the cartridge agent/ or agent plugins can access the API with that token. Request to the API should have the Authorization header in the format of "Authorization: Bearer $jwt_token"
*Add application Property* curl -X *POST* -d "@prop2.json" -H "Content-Type: application/json" -k -H "Authorization: Bearer eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0NDA2ODM0NTUsInN1YiI6ImFkbWluIiwiYXpwIjoieHRwVVYwZldfanJjRU1jODhnN0kxaWY5RTFRYSIsImFwcElkIjoic2luZ2xlLWNhcnRyaWRnZS1hcHAiLCJhdWQiOlsieHRwVVYwZldfanJjRU1jODhnN0kxaWY5RTFRYSJdLCJpc3MiOiJodHRwczpcL1wvbG9jYWxob3N0Ojk0NDNcL29hdXRoMmVuZHBvaW50c1wvdG9rZW4iLCJpYXQiOjE0NDA2ODQ0NTd9.PkVFe1kZQyIkIPRrGwIHE4M6QY0MpFCU2byg2Hig5VJUzuAS_IJzNU8j4RUcx45kn6RRC7Nhk8O9Ywg_j0A83KyEWb2Dmk-LAnpLhROF-IU-abqtr5ANXBLXiZMZttmFt9zMum9oo_MY9wGtVKm8vJR8ZTtL_K6Xls1dA-0753I" -k https://${host_ip}:${host_port}/metadata/api/ *applications/single-cartridge-app/properties * *Get all application properties* curl -X *GET* -H "Content-Type: application/json" -k -H "Authorization: Bearer eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0NDA2ODM0NTUsInN1YiI6ImFkbWluIiwiYXpwIjoieHRwVVYwZldfanJjRU1jODhnN0kxaWY5RTFRYSIsImFwcElkIjoic2luZ2xlLWNhcnRyaWRnZS1hcHAiLCJhdWQiOlsieHRwVVYwZldfanJjRU1jODhnN0kxaWY5RTFRYSJdLCJpc3MiOiJodHRwczpcL1wvbG9jYWxob3N0Ojk0NDNcL29hdXRoMmVuZHBvaW50c1wvdG9rZW4iLCJpYXQiOjE0NDA2ODQ0NTd9.PkVFe1kZQyIkIPRrGwIHE4M6QY0MpFCU2byg2Hig5VJUzuAS_IJzNU8j4RUcx45kn6RRC7Nhk8O9Ywg_j0A83KyEWb2Dmk-LAnpLhROF-IU-abqtr5ANXBLXiZMZttmFt9zMum9oo_MY9wGtVKm8vJR8ZTtL_K6Xls1dA-0753I" -k https://${host_ip}:${host_port}/metadata/api/ *applications/single-cartridge-app/properties* | python -m json.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 245 0 131 100 114 2585 2250 --:--:-- --:--:-- --:--:-- 2620 { "properties": [ { "key": "email", "values": [ "[email protected]", "[email protected]" ] }, { "key": "name", "values": [ "udara", "liyanage" ] } ] } *Get a application property* curl -X *GET* -H "Content-Type: application/json" -k -H "Authorization: Bearer eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0NDA2ODM0NTUsInN1YiI6ImFkbWluIiwiYXpwIjoieHRwVVYwZldfanJjRU1jODhnN0kxaWY5RTFRYSIsImFwcElkIjoic2luZ2xlLWNhcnRyaWRnZS1hcHAiLCJhdWQiOlsieHRwVVYwZldfanJjRU1jODhnN0kxaWY5RTFRYSJdLCJpc3MiOiJodHRwczpcL1wvbG9jYWxob3N0Ojk0NDNcL29hdXRoMmVuZHBvaW50c1wvdG9rZW4iLCJpYXQiOjE0NDA2ODQ0NTd9.PkVFe1kZQyIkIPRrGwIHE4M6QY0MpFCU2byg2Hig5VJUzuAS_IJzNU8j4RUcx45kn6RRC7Nhk8O9Ywg_j0A83KyEWb2Dmk-LAnpLhROF-IU-abqtr5ANXBLXiZMZttmFt9zMum9oo_MY9wGtVKm8vJR8ZTtL_K6Xls1dA-0753I" -k https://${host_ip}:${host_port}/metadata/api/applications/*single-cartridge-app/properties/email * | python -m json.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 183 0 69 100 114 1058 1748 --:--:-- --:--:-- --:--:-- 1781 { "key": "email", "values": [ "[email protected]", "[email protected]" ] } *Delete all application properties* curl -X *DELETE* -H "Content-Type: application/json" -k -H "Authorization: Bearer eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0NDA2ODM0NTUsInN1YiI6ImFkbWluIiwiYXpwIjoieHRwVVYwZldfanJjRU1jODhnN0kxaWY5RTFRYSIsImFwcElkIjoic2luZ2xlLWNhcnRyaWRnZS1hcHAiLCJhdWQiOlsieHRwVVYwZldfanJjRU1jODhnN0kxaWY5RTFRYSJdLCJpc3MiOiJodHRwczpcL1wvbG9jYWxob3N0Ojk0NDNcL29hdXRoMmVuZHBvaW50c1wvdG9rZW4iLCJpYXQiOjE0NDA2ODQ0NTd9.PkVFe1kZQyIkIPRrGwIHE4M6QY0MpFCU2byg2Hig5VJUzuAS_IJzNU8j4RUcx45kn6RRC7Nhk8O9Ywg_j0A83KyEWb2Dmk-LAnpLhROF-IU-abqtr5ANXBLXiZMZttmFt9zMum9oo_MY9wGtVKm8vJR8ZTtL_K6Xls1dA-0753I" -k https://${host_ip}:${host_port}/metadata/api/ *applications/single-cartridge-app/properties * *Add property to a cluster * curl -X *POST* -d "@prop2.json" -H "Content-Type: application/json" -k -H "Authorization: Bearer eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0NDA2ODM0NTUsInN1YiI6ImFkbWluIiwiYXpwIjoieHRwVVYwZldfanJjRU1jODhnN0kxaWY5RTFRYSIsImFwcElkIjoic2luZ2xlLWNhcnRyaWRnZS1hcHAiLCJhdWQiOlsieHRwVVYwZldfanJjRU1jODhnN0kxaWY5RTFRYSJdLCJpc3MiOiJodHRwczpcL1wvbG9jYWxob3N0Ojk0NDNcL29hdXRoMmVuZHBvaW50c1wvdG9rZW4iLCJpYXQiOjE0NDA2ODQ0NTd9.PkVFe1kZQyIkIPRrGwIHE4M6QY0MpFCU2byg2Hig5VJUzuAS_IJzNU8j4RUcx45kn6RRC7Nhk8O9Ywg_j0A83KyEWb2Dmk-LAnpLhROF-IU-abqtr5ANXBLXiZMZttmFt9zMum9oo_MY9wGtVKm8vJR8ZTtL_K6Xls1dA-0753I" -k https://${host_ip}:${host_port}/metadata/api/ *applications/single-cartridge-app/clusters/mycluster/properties * Get cluster propertiess curl -X *GET* -H "Content-Type: application/json" -k -H "Authorization: Bearer eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0NDA2ODM0NTUsInN1YiI6ImFkbWluIiwiYXpwIjoieHRwVVYwZldfanJjRU1jODhnN0kxaWY5RTFRYSIsImFwcElkIjoic2luZ2xlLWNhcnRyaWRnZS1hcHAiLCJhdWQiOlsieHRwVVYwZldfanJjRU1jODhnN0kxaWY5RTFRYSJdLCJpc3MiOiJodHRwczpcL1wvbG9jYWxob3N0Ojk0NDNcL29hdXRoMmVuZHBvaW50c1wvdG9rZW4iLCJpYXQiOjE0NDA2ODQ0NTd9.PkVFe1kZQyIkIPRrGwIHE4M6QY0MpFCU2byg2Hig5VJUzuAS_IJzNU8j4RUcx45kn6RRC7Nhk8O9Ywg_j0A83KyEWb2Dmk-LAnpLhROF-IU-abqtr5ANXBLXiZMZttmFt9zMum9oo_MY9wGtVKm8vJR8ZTtL_K6Xls1dA-0753I" -k https://${host_ip}:${host_port}/metadata/api/ *applications/single-cartridge-app/clusters/mycluster/properties* {"properties":[{"key":"name","values":["udara","liyanage"]}]} *Works to be done* Add more fine grained APIs Add a response message format similar to Stratos REST API, however since users rarely execute metadata api, it is not much needed. -- Udara Liyanage Software Engineer WSO2, Inc.: http://wso2.com lean. enterprise. middleware web: http://udaraliyanage.wordpress.com phone: +94 71 443 6897
