All URIs are relative to https://api.lab5e.com
Method | HTTP request | Description |
---|---|---|
CreateCertificate | POST /span/collections/{collectionId}/certificates/create | Create certificate |
RetrieveCertificateChain | GET /span/collections/{collectionId}/certificates | Get certificate chain |
SignCertificate | POST /span/collections/{collectionId}/certificates/sign | Sign certificate |
VerifyCertificate | POST /span/collections/{collectionId}/certificates/verify | Verify certificate |
CreateCertificateResponse CreateCertificate (string collectionId, CreateCertificateBody body)
Create certificate
Create a new device or gateway (client) certificate for an internet-connected device. The devices will use this client certificate to authenticate when sending data via the Internet endpoint. This will create a X509 client certificate with an ECC public key. The key is not stored by the service so keep it in a secure place once it is downloaded. The returned certificate will be valid for 14 days. The key for the certificate is your own responsibility. The client certificate is used in both the TLS, DTLS and gRPC service endpoints.
using System.Collections.Generic;
using System.Diagnostics;
using Com.Lab5e.Span.Api;
using Com.Lab5e.Span.Client;
using Com.Lab5e.Span.Model;
namespace Example
{
public class CreateCertificateExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.lab5e.com";
// Configure API key authorization: APIToken
config.AddApiKey("X-API-Token", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("X-API-Token", "Bearer");
var apiInstance = new CertificatesApi(config);
var collectionId = "collectionId_example"; // string |
var body = new CreateCertificateBody(); // CreateCertificateBody |
try
{
// Create certificate
CreateCertificateResponse result = apiInstance.CreateCertificate(collectionId, body);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling CertificatesApi.CreateCertificate: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Create certificate
ApiResponse<CreateCertificateResponse> response = apiInstance.CreateCertificateWithHttpInfo(collectionId, body);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling CertificatesApi.CreateCertificateWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Name | Type | Description | Notes |
---|---|---|---|
collectionId | string | ||
body | CreateCertificateBody |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | A successful response. | - |
201 | It's created. | - |
400 | The request has an error. | - |
401 | You can't touch this | - |
404 | Couldn't find the resource. | - |
409 | There's a resource conflict here. | - |
500 | I'm sorry. We are broken | - |
0 | An unexpected error response. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CertificateChainResponse RetrieveCertificateChain (string collectionId, string? gatewayId = null, string? deviceId = null)
Get certificate chain
Get the certificate chain for the root CA and intermediate certificates used by the device, gateway and server certificates. It is highly recommended to verify the server certificate when sending data to avoid any man-in-the-middle attacks. This chain will contain all required certificates needed to verify the client certificate.
using System.Collections.Generic;
using System.Diagnostics;
using Com.Lab5e.Span.Api;
using Com.Lab5e.Span.Client;
using Com.Lab5e.Span.Model;
namespace Example
{
public class RetrieveCertificateChainExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.lab5e.com";
// Configure API key authorization: APIToken
config.AddApiKey("X-API-Token", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("X-API-Token", "Bearer");
var apiInstance = new CertificatesApi(config);
var collectionId = "collectionId_example"; // string |
var gatewayId = "gatewayId_example"; // string? | (optional)
var deviceId = "deviceId_example"; // string? | (optional)
try
{
// Get certificate chain
CertificateChainResponse result = apiInstance.RetrieveCertificateChain(collectionId, gatewayId, deviceId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling CertificatesApi.RetrieveCertificateChain: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Get certificate chain
ApiResponse<CertificateChainResponse> response = apiInstance.RetrieveCertificateChainWithHttpInfo(collectionId, gatewayId, deviceId);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling CertificatesApi.RetrieveCertificateChainWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Name | Type | Description | Notes |
---|---|---|---|
collectionId | string | ||
gatewayId | string? | [optional] | |
deviceId | string? | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | A successful response. | - |
201 | It's created. | - |
400 | The request has an error. | - |
401 | You can't touch this | - |
404 | Couldn't find the resource. | - |
409 | There's a resource conflict here. | - |
500 | I'm sorry. We are broken | - |
0 | An unexpected error response. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
SignCertificateResponse SignCertificate (string collectionId, SignCertificateBody body)
Sign certificate
Sign a device or gateway (aka client) certificate. The certificate is a X509 Certificate signing request PEM encoded. The certificate will be valid for 14 days and must be renewed.
using System.Collections.Generic;
using System.Diagnostics;
using Com.Lab5e.Span.Api;
using Com.Lab5e.Span.Client;
using Com.Lab5e.Span.Model;
namespace Example
{
public class SignCertificateExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.lab5e.com";
// Configure API key authorization: APIToken
config.AddApiKey("X-API-Token", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("X-API-Token", "Bearer");
var apiInstance = new CertificatesApi(config);
var collectionId = "collectionId_example"; // string |
var body = new SignCertificateBody(); // SignCertificateBody |
try
{
// Sign certificate
SignCertificateResponse result = apiInstance.SignCertificate(collectionId, body);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling CertificatesApi.SignCertificate: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Sign certificate
ApiResponse<SignCertificateResponse> response = apiInstance.SignCertificateWithHttpInfo(collectionId, body);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling CertificatesApi.SignCertificateWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Name | Type | Description | Notes |
---|---|---|---|
collectionId | string | ||
body | SignCertificateBody |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | A successful response. | - |
201 | It's created. | - |
400 | The request has an error. | - |
401 | You can't touch this | - |
404 | Couldn't find the resource. | - |
409 | There's a resource conflict here. | - |
500 | I'm sorry. We are broken | - |
0 | An unexpected error response. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
VerifyCertificateResponse VerifyCertificate (string collectionId, VerifyCertificateBody body)
Verify certificate
Verify client certificate. If a client certificate fails it can be tricky to pinpoint exactly why the certificate isn't accepted. This resource validates the client certificate and returns the error in plain text.
using System.Collections.Generic;
using System.Diagnostics;
using Com.Lab5e.Span.Api;
using Com.Lab5e.Span.Client;
using Com.Lab5e.Span.Model;
namespace Example
{
public class VerifyCertificateExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.lab5e.com";
// Configure API key authorization: APIToken
config.AddApiKey("X-API-Token", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("X-API-Token", "Bearer");
var apiInstance = new CertificatesApi(config);
var collectionId = "collectionId_example"; // string |
var body = new VerifyCertificateBody(); // VerifyCertificateBody |
try
{
// Verify certificate
VerifyCertificateResponse result = apiInstance.VerifyCertificate(collectionId, body);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling CertificatesApi.VerifyCertificate: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Verify certificate
ApiResponse<VerifyCertificateResponse> response = apiInstance.VerifyCertificateWithHttpInfo(collectionId, body);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling CertificatesApi.VerifyCertificateWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Name | Type | Description | Notes |
---|---|---|---|
collectionId | string | ||
body | VerifyCertificateBody |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | A successful response. | - |
201 | It's created. | - |
400 | The request has an error. | - |
401 | You can't touch this | - |
404 | Couldn't find the resource. | - |
409 | There's a resource conflict here. | - |
500 | I'm sorry. We are broken | - |
0 | An unexpected error response. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]