Create a Certificate for a Device
curl --request POST \
--url https://manage.nervescloud.com/api/orgs/{org_name}/products/{product_name}/devices/{identifier}/certificates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cert": "[Base64 encoded certificate]=="
}
'import requests
url = "https://manage.nervescloud.com/api/orgs/{org_name}/products/{product_name}/devices/{identifier}/certificates"
payload = { "cert": "[Base64 encoded certificate]==" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({cert: '[Base64 encoded certificate]=='})
};
fetch('https://manage.nervescloud.com/api/orgs/{org_name}/products/{product_name}/devices/{identifier}/certificates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://manage.nervescloud.com/api/orgs/{org_name}/products/{product_name}/devices/{identifier}/certificates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cert' => '[Base64 encoded certificate]=='
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://manage.nervescloud.com/api/orgs/{org_name}/products/{product_name}/devices/{identifier}/certificates"
payload := strings.NewReader("{\n \"cert\": \"[Base64 encoded certificate]==\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://manage.nervescloud.com/api/orgs/{org_name}/products/{product_name}/devices/{identifier}/certificates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"cert\": \"[Base64 encoded certificate]==\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://manage.nervescloud.com/api/orgs/{org_name}/products/{product_name}/devices/{identifier}/certificates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cert\": \"[Base64 encoded certificate]==\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"not_after": "2052-12-15T21:00:00Z",
"not_before": "2022-12-15T20:00:00Z",
"serial": "123456789101112"
}
}{
"errors": {
"detail": "Resource Not Found or Authorization Insufficient"
}
}{
"errors": {
"detail": "Resource Not Found or Authorization Insufficient"
}
}{
"errors": {
"identifier": [
"can't be blank"
]
}
}Device Certificates
Create a Certificate for a Device
POST
/
api
/
orgs
/
{org_name}
/
products
/
{product_name}
/
devices
/
{identifier}
/
certificates
Create a Certificate for a Device
curl --request POST \
--url https://manage.nervescloud.com/api/orgs/{org_name}/products/{product_name}/devices/{identifier}/certificates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cert": "[Base64 encoded certificate]=="
}
'import requests
url = "https://manage.nervescloud.com/api/orgs/{org_name}/products/{product_name}/devices/{identifier}/certificates"
payload = { "cert": "[Base64 encoded certificate]==" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({cert: '[Base64 encoded certificate]=='})
};
fetch('https://manage.nervescloud.com/api/orgs/{org_name}/products/{product_name}/devices/{identifier}/certificates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://manage.nervescloud.com/api/orgs/{org_name}/products/{product_name}/devices/{identifier}/certificates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cert' => '[Base64 encoded certificate]=='
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://manage.nervescloud.com/api/orgs/{org_name}/products/{product_name}/devices/{identifier}/certificates"
payload := strings.NewReader("{\n \"cert\": \"[Base64 encoded certificate]==\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://manage.nervescloud.com/api/orgs/{org_name}/products/{product_name}/devices/{identifier}/certificates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"cert\": \"[Base64 encoded certificate]==\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://manage.nervescloud.com/api/orgs/{org_name}/products/{product_name}/devices/{identifier}/certificates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cert\": \"[Base64 encoded certificate]==\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"not_after": "2052-12-15T21:00:00Z",
"not_before": "2022-12-15T20:00:00Z",
"serial": "123456789101112"
}
}{
"errors": {
"detail": "Resource Not Found or Authorization Insufficient"
}
}{
"errors": {
"detail": "Resource Not Found or Authorization Insufficient"
}
}{
"errors": {
"identifier": [
"can't be blank"
]
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Organization Name
Product Name
Device Identifier
Body
application/json
Device Certificate create request
POST body for creating a Certificate for a Device
Base64 encoded certificate
Response
Device Certificate show response
Device Certificate show response
Show child attributes
Show child attributes
Example:
{
"not_after": "2052-12-15T21:00:00Z",
"not_before": "2022-12-15T20:00:00Z",
"serial": "123456789101112"
}

