devicesV2Create
+create devices_v2
+Creates a new device associated to the user.
+ ++
/v2/devices
+ +
Usage and SDK Samples
+ + + +curl -X PUT "http://api-dev.arduino.cc/iot/v2/devices"
+ import org.openapitools.client.*;
+import org.openapitools.client.auth.*;
+import org.openapitools.client.model.*;
+import org.openapitools.client.api.DevicesV2Api;
+
+import java.io.File;
+import java.util.*;
+
+public class DevicesV2ApiExample {
+
+ public static void main(String[] args) {
+ ApiClient defaultClient = Configuration.getDefaultApiClient();
+
+ // Configure OAuth2 access token for authorization: oauth2
+ OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
+ oauth2.setAccessToken("YOUR ACCESS TOKEN");
+
+ DevicesV2Api apiInstance = new DevicesV2Api();
+ CreateDevicesV2Payload createDevicesV2Payload = ; // CreateDevicesV2Payload |
+ try {
+ ArduinoDevicev2 result = apiInstance.devicesV2Create(createDevicesV2Payload);
+ System.out.println(result);
+ } catch (ApiException e) {
+ System.err.println("Exception when calling DevicesV2Api#devicesV2Create");
+ e.printStackTrace();
+ }
+ }
+}
+ import org.openapitools.client.api.DevicesV2Api;
+
+public class DevicesV2ApiExample {
+
+ public static void main(String[] args) {
+ DevicesV2Api apiInstance = new DevicesV2Api();
+ CreateDevicesV2Payload createDevicesV2Payload = ; // CreateDevicesV2Payload |
+ try {
+ ArduinoDevicev2 result = apiInstance.devicesV2Create(createDevicesV2Payload);
+ System.out.println(result);
+ } catch (ApiException e) {
+ System.err.println("Exception when calling DevicesV2Api#devicesV2Create");
+ e.printStackTrace();
+ }
+ }
+}
+ Configuration *apiConfig = [Configuration sharedConfig];
+
+// Configure OAuth2 access token for authorization: (authentication scheme: oauth2)
+[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
+
+CreateDevicesV2Payload *createDevicesV2Payload = ; //
+
+DevicesV2Api *apiInstance = [[DevicesV2Api alloc] init];
+
+// create devices_v2
+[apiInstance devicesV2CreateWith:createDevicesV2Payload
+ completionHandler: ^(ArduinoDevicev2 output, NSError* error) {
+ if (output) {
+ NSLog(@"%@", output);
+ }
+ if (error) {
+ NSLog(@"Error: %@", error);
+ }
+ }];
+
+ var IotApi = require('iot_api');
+var defaultClient = IotApi.ApiClient.instance;
+
+// Configure OAuth2 access token for authorization: oauth2
+var oauth2 = defaultClient.authentications['oauth2'];
+oauth2.accessToken = "YOUR ACCESS TOKEN"
+
+var api = new IotApi.DevicesV2Api()
+var createDevicesV2Payload = ; // {CreateDevicesV2Payload}
+
+var callback = function(error, data, response) {
+ if (error) {
+ console.error(error);
+ } else {
+ console.log('API called successfully. Returned data: ' + data);
+ }
+};
+api.devicesV2Create(createDevicesV2Payload, callback);
+
+ using System;
+using System.Diagnostics;
+using iot.Api;
+using iot.Client;
+using iot.Model;
+
+namespace Example
+{
+ public class devicesV2CreateExample
+ {
+ public void main()
+ {
+
+ // Configure OAuth2 access token for authorization: oauth2
+ Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
+
+ var apiInstance = new DevicesV2Api();
+ var createDevicesV2Payload = new CreateDevicesV2Payload(); // CreateDevicesV2Payload |
+
+ try
+ {
+ // create devices_v2
+ ArduinoDevicev2 result = apiInstance.devicesV2Create(createDevicesV2Payload);
+ Debug.WriteLine(result);
+ }
+ catch (Exception e)
+ {
+ Debug.Print("Exception when calling DevicesV2Api.devicesV2Create: " + e.Message );
+ }
+ }
+ }
+}
+
+ <?php
+require_once(__DIR__ . '/vendor/autoload.php');
+
+// Configure OAuth2 access token for authorization: oauth2
+OpenAPITools\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+$api_instance = new OpenAPITools\Client\Api\DevicesV2Api();
+$createDevicesV2Payload = ; // CreateDevicesV2Payload |
+
+try {
+ $result = $api_instance->devicesV2Create($createDevicesV2Payload);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling DevicesV2Api->devicesV2Create: ', $e->getMessage(), PHP_EOL;
+}
+?>
+ use Data::Dumper;
+use WWW::OPenAPIClient::Configuration;
+use WWW::OPenAPIClient::DevicesV2Api;
+
+# Configure OAuth2 access token for authorization: oauth2
+$WWW::OPenAPIClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';
+
+my $api_instance = WWW::OPenAPIClient::DevicesV2Api->new();
+my $createDevicesV2Payload = WWW::OPenAPIClient::Object::CreateDevicesV2Payload->new(); # CreateDevicesV2Payload |
+
+eval {
+ my $result = $api_instance->devicesV2Create(createDevicesV2Payload => $createDevicesV2Payload);
+ print Dumper($result);
+};
+if ($@) {
+ warn "Exception when calling DevicesV2Api->devicesV2Create: $@\n";
+}
+ from __future__ import print_statement
+import time
+import openapi_client
+from openapi_client.rest import ApiException
+from pprint import pprint
+
+# Configure OAuth2 access token for authorization: oauth2
+openapi_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
+
+# create an instance of the API class
+api_instance = openapi_client.DevicesV2Api()
+createDevicesV2Payload = # CreateDevicesV2Payload |
+
+try:
+ # create devices_v2
+ api_response = api_instance.devices_v2_create(createDevicesV2Payload)
+ pprint(api_response)
+except ApiException as e:
+ print("Exception when calling DevicesV2Api->devicesV2Create: %s\n" % e)
+ extern crate DevicesV2Api;
+
+pub fn main() {
+ let createDevicesV2Payload = ; // CreateDevicesV2Payload
+
+ let mut context = DevicesV2Api::Context::default();
+ let result = client.devicesV2Create(createDevicesV2Payload, &context).wait();
+ println!("{:?}", result);
+
+}
+
+ Scopes
+Parameters
+ + + +Name | +Description | +
---|---|
createDevicesV2Payload * | +
+ DeviceV2 describes a device. + + + |
+