Creating registries and devices
Device Registry
Creating a device registry
// createRegistry creates a OmniCore device registry associated with a PubSub topic
package main
import (
"bytes"
"fmt"
"io"
"log"
"net/http"
"os"
)
var BASEURL = "<BaseUrl>"
var subscription = "<subscriptionId>"
var token = "Bearer <token>"
var url = fmt.Sprintf("%s/subscriptions/%s/registries", BASEURL, subscription)
func main() {
var jsonData = []byte(`{"id": "<id>","eventNotificationConfigs": [{"pubsubTopicName": "<topicName>"}]}`)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header = http.Header{
"Content-Type": {"application/json"},
"Authorization": {token},
}
client := &http.Client{}
res, e := client.Do(req)
if e != nil {
log.Fatal(e)
}
defer res.Body.Close()
fmt.Println("response Status:", res.Status)
fmt.Println("Created registry")
// Print the body to the stdout
io.Copy(os.Stdout, res.Body)
}
Creating a device registry with multiple Pub/Sub topics
Creating Device
Creating device key pairs
Creating or editing a device
Using Console
Using APIs
Credential and certificate expiration dates
Getting device details
Using Console
Using APIs
Deleting devices and registries
Using APIs
Last updated