import 'package:spanapi/api.dart';
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(collectionId, 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.
import 'package:spanapi/api.dart';
// TODO Configure API key authorization: APIToken
//defaultApiClient.getAuthentication<ApiKeyAuth>('APIToken').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('APIToken').apiKeyPrefix = 'Bearer';
final api_instance = CertificatesApi();
final collectionId = collectionId_example; // String |
final body = CreateCertificateBody(); // CreateCertificateBody |
try {
final result = api_instance.createCertificate(collectionId, body);
print(result);
} catch (e) {
print('Exception when calling CertificatesApi->createCertificate: $e\n');
}
Name | Type | Description | Notes |
---|---|---|---|
collectionId | String | ||
body | CreateCertificateBody |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CertificateChainResponse retrieveCertificateChain(collectionId, gatewayId, deviceId)
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.
import 'package:spanapi/api.dart';
// TODO Configure API key authorization: APIToken
//defaultApiClient.getAuthentication<ApiKeyAuth>('APIToken').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('APIToken').apiKeyPrefix = 'Bearer';
final api_instance = CertificatesApi();
final collectionId = collectionId_example; // String |
final gatewayId = gatewayId_example; // String |
final deviceId = deviceId_example; // String |
try {
final result = api_instance.retrieveCertificateChain(collectionId, gatewayId, deviceId);
print(result);
} catch (e) {
print('Exception when calling CertificatesApi->retrieveCertificateChain: $e\n');
}
Name | Type | Description | Notes |
---|---|---|---|
collectionId | String | ||
gatewayId | String | [optional] | |
deviceId | String | [optional] |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
SignCertificateResponse signCertificate(collectionId, 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.
import 'package:spanapi/api.dart';
// TODO Configure API key authorization: APIToken
//defaultApiClient.getAuthentication<ApiKeyAuth>('APIToken').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('APIToken').apiKeyPrefix = 'Bearer';
final api_instance = CertificatesApi();
final collectionId = collectionId_example; // String |
final body = SignCertificateBody(); // SignCertificateBody |
try {
final result = api_instance.signCertificate(collectionId, body);
print(result);
} catch (e) {
print('Exception when calling CertificatesApi->signCertificate: $e\n');
}
Name | Type | Description | Notes |
---|---|---|---|
collectionId | String | ||
body | SignCertificateBody |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
VerifyCertificateResponse verifyCertificate(collectionId, 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.
import 'package:spanapi/api.dart';
// TODO Configure API key authorization: APIToken
//defaultApiClient.getAuthentication<ApiKeyAuth>('APIToken').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('APIToken').apiKeyPrefix = 'Bearer';
final api_instance = CertificatesApi();
final collectionId = collectionId_example; // String |
final body = VerifyCertificateBody(); // VerifyCertificateBody |
try {
final result = api_instance.verifyCertificate(collectionId, body);
print(result);
} catch (e) {
print('Exception when calling CertificatesApi->verifyCertificate: $e\n');
}
Name | Type | Description | Notes |
---|---|---|---|
collectionId | String | ||
body | VerifyCertificateBody |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]