Microshare Admin API
Dev Server : dapp.microshare.io
Prod Server : app.microshare.io
Before tackling the concepts on this page, please follow the Microshare Share API guide first!
These requests allow you to outsource actions made on the Microshare Composer. Before exercising this ability, you must understand how an item works on Microshare before using the corresponding APIs.
For this part we will assume that you are comfortable with interacting with the Microshare APIs, and the Microshare platform..
Have a question not answered here? Do not hesitate to contact us at support@microshare.io
!
Authentication
Request and revoke tokens used to authenticate to our API
Request pipe Token
Request a pipe Authentification token, required to stream data to your microshare account.
You will need to provide username, password, as well as a valid API Key. You can manage your API keys in our Keys Console.
The default scope is ALL:ALL
, but you can replace it to request tokens that will allow limited operations. For example, if the scope is SHARE:READ
the token will only allow you to read Shares.
var settings = {
"url": "{{authHostname}}/oauth2/token?username={{username}}&password={{password}}&client_id={{apikey}}&grant_type=pipe&scope=ALL:ALL",
"method": "POST",
"timeout": 0,
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Request Token
Request an Authentification token required to use this API.
You will need to provide username, password, as well as a valid API Key. You can manage your API keys in our Keys Console.
The default scope is ALL:ALL
, but you can replace it to request tokens that will allow limited operations. For example, if the scope is SHARE:READ
the token will only allow you to read Shares.
var settings = {
"url": "{{authHostname}}/oauth2/token?username={{username}}&password={{password}}&client_id={{apikey}}&grant_type=password&scope=ALL:ALL",
"method": "POST",
"timeout": 0,
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Request Token via Body
Request an Authentification token required to use this API.
You will need to provide username, password, as well as a valid API Key. You can manage your API keys in our Keys Console.
The default scope is ALL:ALL
, but you can replace it to request tokens that will allow limited operations. For example, if the scope is SHARE:READ
the token will only allow you to read Shares.
{
"username":"{{username}}",
"password":"{{password}}",
"client_id":"{{apikey}}",
"grant_type":"password",
"scope":"ALL:ALL"
}
var settings = {
"url": "{{authHostname}}/oauth2/token",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json"
},
"data": JSON.stringify({"username":"{{username}}","password":"{{password}}","client_id":"{{apikey}}","grant_type":"password","scope":"ALL:ALL"}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Shares
Each piece of data is called a "Share", here you can find all the requests to access your data.
Get one Share
Retrieve one share by recType
and object id
var settings = {
"url": "{{hostname}}/share/io.microshare.test/59238b9346e0fb0352c2948b",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Get Shares by recType
Retrieve all shares under a specific recType
var settings = {
"url": "{{hostname}}/share/io.microshare.test?details=true",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Get Shares by Tags and recType
Retrieve all shares under a specific recType
and containing one or several tags
. Specify as many tags
as you need, and objects containing all of these tags will be returned.
var settings = {
"url": "{{hostname}}/share/io.microshare.test/tags/foo/bar?details=true&page=&perPage=",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Get Latest Shares by recType
Retrieve all shares under a specific recType
var settings = {
"url": "{{hostname}}/share/io.microshare.test/tags/latest?details=true&page=&perPage=",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Get Data Through a View
Microshare give you access to a powerful tool called a "View", through a view you can query a huge amount of data, transform it, do some calculation and display it as you want.
This API call require the view_id
, view_rectype
, to use the right view and the rectype
value correspond to your data rectype.
var settings = {
"url": "{{hostname}}/share/?view_id=5e9ddb9b46e0fb0028665857&recType=io.microshare.test",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Create one Share
Create a new share by recType
. This inserts a new record into the Microshare data lake.
You must include a record type using the dot notation format (eg. io.microshare.test
).
{
"hello": "world"
}
var settings = {
"url": "{{hostname}}/share/io.microshare.test",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer {{token}}"
},
"data": JSON.stringify({"hello":"world"}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Create one Share with Tags
Create a new share by recType
, with searchable tags
. This inserts a new record into the Microshare data lake.
You must include a record type using the dot notation format (eg. io.microshare.test
).
Tags allow you to later search objects with the same recType
with a GET
request. You can specify as many tags as you need.
{
"hello": "world"
}
var settings = {
"url": "{{hostname}}/share/io.microshare.test/tags/Building/Floor/Room",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer {{token}}"
},
"data": JSON.stringify({"hello":"world"}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Delete one Share
Permanently delete one share by recType
and object id
var settings = {
"url": "{{hostname}}/share/io.microshare.test/592331ce46e0fb0352c293ed",
"method": "DELETE",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Device
Upload your data and easily share it with the Share API
Create one device
Create a new Device Cluster by recType
. This creates a new Device Cluster (DC) into your account, this DC is going to handle your device and will start the unpacking process.
You must include a some informations in the body as explained below :
{
"desc":"Motion Cluster API",
"name":"Test Device Cluster",
"data":{
"isActive": true,
"readAuth": "",
"writeAuth": "",
"devices":[
{
"id":"58-A0-CB-00-00-00-00-00",
"meta":{
"lora":{
"AppKey":"GD711F6F52AE456IB95A1820EB36713A",
"NwkKey":"235FBCC234ADAB685BCB23AA0923DCD32",
"JoinEUI":"58-A0-CB-00-00-00-00-01",
var settings = {
"url": "{{hostname}}/device/io.microshare.test",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer {{token}}"
},
"data": JSON.stringify({"desc":"Motion Cluster API","name":"Test Device Cluster","data":{"isActive":true,"readAuth":"","writeAuth":"","devices":[{"id":"58-A0-CB-00-00-00-00-00","meta":{"lora":{"AppKey":"GD711F6F52AE456IB95A1820EB36713A","NwkKey":"235FBCC234ADAB685BCB23AA0923DCD32","JoinEUI":"58-A0-CB-00-00-00-00-01","DevEUI":"58-A0-CB-00-00-00-00-00"},"location":["Building 1","Floor 1","Room 1"]},"status":"pending"}],"network":{"network":"com.kerlink.wmc"},"meta":{"type":"io.tracknet.healthy.TBHV100.Decoder","unpacker":"io.tracknet.healthy.TBHV100.Decoder","location":"Microshare, Demo, Environment"},"targetRecType":"io.microshare.test.unpacked","recType":"io.microshare.test"}}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Create one device with Tags
It works the same as the previous request, and the tags will be added as metatags to the DC.
{
"_id": "foobar",
"name": "test",
"desc": "test via api",
"data": {
"devices": [],
"network": {},
"meta": {}
}
}
var settings = {
"url": "{{hostname}}/device/io.microshare.test/tags/foo/bar",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer {{token}}"
},
"data": JSON.stringify({"_id":"foobar","name":"test","desc":"test via api","data":{"devices":[],"network":{},"meta":{}}}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Get All Devices
Get the list of all your device clusters. Including there settings and the devices they contain.
var settings = {
"url": "https://dapi.microshare.io/device/*?details=true&page=1&perPage=200&discover=false&field=name&search=",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Get one Device
Retrieve one Device Cluster by recType
and object id
var settings = {
"url": "{{hostname}}/device/io.microshare.test/59238b9346e0fb0352c2948b",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Get Device by recType
Retrieve all Device Clusters under a specific recType
var settings = {
"url": "{{hostname}}/device/io.microshare.test?details=true&page=&perPage=",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Get Devices by Tags and recType
Retrieve all Device Clusters under a specific recType
and containing one or several tags
. Specify as many tags
as you need, and objects containing all of these tags will be returned.
var settings = {
"url": "{{hostname}}/device/io.microshare.test/tags/foo/bar?details=true&page=&perPage=",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Get Latest Device by recType
Retrieve the latest Device Cluster by recType.
var settings = {
"url": "{{hostname}}/device/io.microshare.test/tags/latest?details=true&page=&perPage=",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Delete one Device
Permanently delete one Device Cluster by recType
and object id
var settings = {
"url": "{{hostname}}/device/io.microshare.test/5ad9fedfc5d7677f81e4b873",
"method": "DELETE",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Update one Device
Update one Device Cluster by recType
and object id
. You will have to set in the Body the new settings of your device cluster. Be careful the changes are permanent.
{
"name": "test22",
"desc": "test via api",
"data": {
"devices": [],
"network": {},
"meta": {}
}
}
var settings = {
"url": "{{hostname}}/device/io.microshare.test/5ad9fedfc5d7677f81e4b873",
"method": "PUT",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{token}}"
},
"data": "{\n \"name\": \"test22\",\n \"desc\": \"test via api\",\n \"data\": {\n \"devices\": [],\n \"network\": {},\n \"meta\": {}\n }\n}",
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Rule
Access your Microshare sharing Rules directly from the API, get the list of your rules, create or modify a rule and finally if necessary you can delete a Rule.
Get All Rules
Get the list of all your Rules. You will be able to see what you are sharing with who like if you were on the Microshare Composer.
var settings = {
"url": "{{hostname}}/rule/*?details=true&page=1",
"method": "GET",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Get Rules by recType
Get the list of your Rules by recType
.
You will be able to see what you are sharing with who like if you were on the Microshare Composer.
var settings = {
"url": "{{hostname}}/rule/*?details=true&page=1",
"method": "GET",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Create Rule by recType
Create a share Rule directly form the API, simply complete the body to set which data you share with who.
Here are the details on the different body tags :
- Read : ability to simply read the resource
- Query : ability to query the resource (through a view for instance)
- Write : ability to modify the resource, or write a resource if it's an access to entire recType for instance
- Delete : ability to delete the resource or part of it
- Execute : ability to execute the resource (use a view for instance)
- Policy : ability to share the resource again
you can set many operations at once : {
"_id":"foobar",
"name":"test",
"desc":"",
"data":{
"resourceType":"objs",
"resourceId":"*",
"ownerUser":"email@owner.io",
"ownerOrg":"io.microshare",
"ownerApp":"*",
"callingUser":"*",
"callingOrg":"*",
"callingApp":"*",
"callingRole":"*",
"callingLoc":"*",
var settings = {
"url": "{{hostname}}/rule/io.microshare.test/",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer {{token}}"
},
"data": JSON.stringify({"_id":"foobar","name":"test","desc":"","data":{"resourceType":"objs","resourceId":"*","ownerUser":"email@owner.io","ownerOrg":"io.microshare","ownerApp":"*","callingUser":"*","callingOrg":"*","callingApp":"*","callingRole":"*","callingLoc":"*","operations":["Read"]}}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Update Rule by recType and id
Modify a Rule by recType
and Id
, these changes are permanent.
Here are the details on the different body tags :
- Read : ability to simply read the resource
- Query : ability to query the resource (through a view for instance)
- Write : ability to modify the resource, or write a resource if it's an access to entire recType for instance
- Delete : ability to delete the resource or part of it
- Execute : ability to execute the resource (use a view for instance)
- Policy : ability to share the resource again
you can set many operations at once : {
"_id":"foobar",
"name":"testv2",
"desc":"",
"data":{
"resourceType":"objs",
"resourceId":"*",
"ownerUser":"email@owner.io",
"ownerOrg":"io.microshare",
"ownerApp":"appid1",
"callingUser":"*",
"callingOrg":"*",
"callingApp":"*",
"callingRole":"*",
"callingLoc":"*",
var settings = {
"url": "{{hostname}}/rule/io.microshare.test/5fab0544374c1e477994d78a",
"method": "PUT",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer {{token}}"
},
"data": JSON.stringify({"_id":"foobar","name":"testv2","desc":"","data":{"resourceType":"objs","resourceId":"*","ownerUser":"email@owner.io","ownerOrg":"io.microshare","ownerApp":"appid1","callingUser":"*","callingOrg":"*","callingApp":"*","callingRole":"*","callingLoc":"*","operations":["Read"]}}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Delete Rules by recType and Id
Permanently delete a Rule by recType
and Id
.
{
"_id": "betternotchange",
"id": "nochange",
"name": "new name from PUT",
"desc": "PUT an update",
"recType": "shouldnotsee",
"data": {
"resourceType": "objs",
"resourceId": "*",
"ownerUser": "email@owner.io",
"ownerOrg": "io.microshare",
"ownerApp": "*",
"callingUser": "*",
"callingOrg": "*",
"callingApp": "*",
var settings = {
"url": "{{hostname}}/rule/io.microshare.test/5981f3c946e0fb00203b3796",
"method": "DELETE",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer {{token}}"
},
"data": JSON.stringify({"_id":"betternotchange","id":"nochange","name":"new name from PUT","desc":"PUT an update","recType":"shouldnotsee","data":{"resourceType":"objs","resourceId":"*","ownerUser":"email@owner.io","ownerOrg":"io.microshare","ownerApp":"*","callingUser":"*","callingOrg":"*","callingApp":"*","callingRole":"*","callingLoc":172.23,"operations":["Read","Execute"]}}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Views
Create and manage Views directly from the API
Get All Views
Get the list of all the views you owe and the views you have access to (shared).
var settings = {
"url": "{{hostname}}/view/io.microshare.fm.master.agg?details=true&page=&perPage=",
"method": "GET",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Find Views by recType
Get the list of your Views by recType
. Most of the Microshare Views are using the recType : io.microshare.fm.master.agg. Only few views are using an other recType for specific cases.
You will be able to see what you are sharing with who like if you were on the Microshare Composer.
var settings = {
"url": "{{hostname}}/view/io.microshare.fm.master.agg?details=true&page=&perPage=",
"method": "GET",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Find Views by recType and Id
Search a specific view by recType
and Id
.
var settings = {
"url": "{{hostname}}/view/io.microshare.fm.master.agg/5d37193746e0fb002a9cb09e",
"method": "GET",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Delete View by Id
Permanently delete a View by recType
and Id
.
{
"_id": "betternotchange",
"id": "nochange",
"name": "new name from PUT",
"desc": "PUT an update",
"recType": "shouldnotsee",
"data": {
"resourceType": "objs",
"resourceId": "*",
"ownerUser": "email@owner.io",
"ownerOrg": "io.microshare",
"ownerApp": "*",
"callingUser": "*",
"callingOrg": "*",
"callingApp": "*",
var settings = {
"url": "{{hostname}}/view/io.microshare.test/5981f3c946e0fb00203b3796",
"method": "DELETE",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer {{token}}"
},
"data": JSON.stringify({"_id":"betternotchange","id":"nochange","name":"new name from PUT","desc":"PUT an update","recType":"shouldnotsee","data":{"resourceType":"objs","resourceId":"*","ownerUser":"email@owner.io","ownerOrg":"io.microshare","ownerApp":"*","callingUser":"*","callingOrg":"*","callingApp":"*","callingRole":"*","callingLoc":172.23,"operations":["Read","Execute"]}}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Robots
Create and manage Robots directly from the API
Create a Robot
Create a new Robot by recType
. This creates a new Robot that automates the tasks associated with transforming, enriching, and annotating your data.
You must include a record type using the dot notation format (eg. io.microshare.test
) this is the data source you are going to trigger.
{
"name": "NEW ROBOT CONFIGURATION",
"desc": "",
"recType": "io.microshare.test",
"data": {
"scopes": [
"SHARE:READ",
"SHARE:WRITE"
],
"auth": "test",
"script": "var lib = require('./libs/helpers');\nfunction main(text, auth){\n var count = bindings.count;\n print('HELLO CUSTOM!!: ' + count);\n bindings.count = count + 1;\n}",
"isActive": true,
"schedule": {
"delay": 5000,
"interval": 5000
var settings = {
"url": "{{hostname}}/robo/io.microshare.test",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer {{token}}"
},
"data": JSON.stringify({"name":"NEW ROBOT CONFIGURATION","desc":"","recType":"io.microshare.test","data":{"scopes":["SHARE:READ","SHARE:WRITE"],"auth":"test","script":"var lib = require('./libs/helpers');\nfunction main(text, auth){\n var count = bindings.count;\n print('HELLO CUSTOM!!: ' + count);\n bindings.count = count + 1;\n}","isActive":true,"schedule":{"delay":5000,"interval":5000}}}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Get All Robots
Retrieve all your Robots.
var settings = {
"url": "{{hostname}}/robo/*?details=true&page=&perPage=1000",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Get Robots by recType
Retrieve all your Robots by recType
/
var settings = {
"url": "{{hostname}}/share/?details=true&page=&perPage=1000",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Get Robot by recType and Id
Retrieve a specific Robot by recType
and Id
.
var settings = {
"url": "{{hostname}}/robo/io.microshare.test/58fe78504d74e21f64ff511b",
"method": "GET",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Stream
Use the Microshare Streaming option to directly push your data to your big data tenancy
Create one stream
Create a new share by recType
. This creates a new Streaming process into the Microshare data management.
You must include a record type using the dot notation format (eg. io.microshare.test
).
{
"desc":"Motion Cluster API",
"name":"Test Device Cluster",
"recType": "io.microshare.test-only.test-only",
"data":{
"recTypes": ["com.test.test"],
"streamType": "kafka",
"targetType": "create",
"targetTopic": "foo.topic",
"isActive": true,
"server":{
"network":"somejunk"
},
"ownership":[
{
var settings = {
"url": "{{hostname}}/stream/io.microshare.test",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer {{token}}"
},
"data": JSON.stringify({"desc":"Motion Cluster API","name":"Test Device Cluster","recType":"io.microshare.test-only.test-only","data":{"recTypes":["com.test.test"],"streamType":"kafka","targetType":"create","targetTopic":"foo.topic","isActive":true,"server":{"network":"somejunk"},"ownership":[{"appid":"*","org":"*","user":"tpanagos@microshare.io"}]}}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Create one stream with Tags
Create a new Stream by recType
, with searchable tags
. This creates a new Streaming process into the Microshare data management.
You must include a record type using the dot notation format (eg. io.microshare.test
).
Tags allow you to later search objects with the same recType
with a GET
request. You can specify as many tags as you need.
{
"_id": "foobar",
"name": "test",
"desc": "test via api",
"data": {
"devices": [],
"network": {},
"meta": {}
}
}
var settings = {
"url": "{{hostname}}/stream/io.microshare.test/tags/foo/bar",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer {{token}}"
},
"data": JSON.stringify({"_id":"foobar","name":"test","desc":"test via api","data":{"devices":[],"network":{},"meta":{}}}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Get one Stream
Retrieve one Stream by recType
and object id
var settings = {
"url": "{{hostname}}/stream/io.microshare.test/59238b9346e0fb0352c2948b",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Get Stream by recType
Retrieve all Stream under a specific recType
var settings = {
"url": "{{hostname}}/stream/io.microshare.test?details=true&page=&perPage=",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Get Streams by Tags and recType
Retrieve all Streams under a specific recType
and containing one or several tags
. Specify as many tags
as you need, and objects containing all of these tags will be returned.
var settings = {
"url": "{{hostname}}/stream/io.microshare.test/tags/foo/bar?details=true&page=&perPage=",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Get Latest Device by recType
Retrieve all Streams under a specific recType
var settings = {
"url": "{{hostname}}/stream/io.microshare.test/tags/latest?details=true&page=&perPage=",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Delete one Stream
Permanently delete one Stream by recType
and object id
var settings = {
"url": "{{hostname}}/stream/io.microshare.test/5f9c9d6f3343a13b005fadab",
"method": "DELETE",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{token}}"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Update one Stream
Permanently delete one Stream by recType
and object id
{
"desc":"Update from Postman",
"name":"Updated Test Device Cluster",
"data":{
"recTypes": ["test","added"],
"streamType": "eventhub",
"targetType": "create",
"targetTopic": "foo.topic",
"isActive": true,
"server":{
"network":"somejunk"
},
"ownership":[
{
"appid":"*",
var settings = {
"url": "{{hostname}}/stream/io.microshare.test/5f9c9d6f3343a13b005fadab",
"method": "PUT",
"timeout": 0,
"headers": {
"Authorization": "Bearer {{token}}"
},
"data": "{\n \"desc\":\"Update from Postman\",\n \"name\":\"Updated Test Device Cluster\",\n \"data\":{\n \"recTypes\": [\"test\",\"added\"],\n \"streamType\": \"eventhub\",\n \"targetType\": \"create\",\n \"targetTopic\": \"foo.topic\",\n \"isActive\": true,\n \"server\":{\n \"network\":\"somejunk\"\n },\n \"ownership\":[\n \t{\n \"appid\":\"*\",\n \"org\":\"*\",\n \"user\":\"tpanagos@microshare.io\"\n \t}\n ]\n }\n}",
};
$.ajax(settings).done(function (response) {
console.log(response);
});