createInstance
Create an instance
If id is not provided, it will be randomly generated
/instances/create
Usage and SDK Samples
curl -X PUT -H "Authorization: [[apiKey]]" "http://otpixel.satrdlab.upv.es:8080/otpixel/api/instances/create"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.InstanceResourceApi;
import java.io.File;
import java.util.*;
public class InstanceResourceApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: apikey
ApiKeyAuth apikey = (ApiKeyAuth) defaultClient.getAuthentication("apikey");
apikey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apikey.setApiKeyPrefix("Token");
InstanceResourceApi apiInstance = new InstanceResourceApi();
Instance body = ; // Instance | Instance description
try {
Instance result = apiInstance.createInstance(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling InstanceResourceApi#createInstance");
e.printStackTrace();
}
}
}
import io.swagger.client.api.InstanceResourceApi;
public class InstanceResourceApiExample {
public static void main(String[] args) {
InstanceResourceApi apiInstance = new InstanceResourceApi();
Instance body = ; // Instance | Instance description
try {
Instance result = apiInstance.createInstance(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling InstanceResourceApi#createInstance");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure API key authorization: (authentication scheme: apikey)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"Authorization"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"Authorization"];
Instance *body = ; // Instance description
InstanceResourceApi *apiInstance = [[InstanceResourceApi alloc] init];
// Create an instance
[apiInstance createInstanceWith:body
completionHandler: ^(Instance output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var Otpixel = require('otpixel');
var defaultClient = Otpixel.ApiClient.instance;
// Configure API key authorization: apikey
var apikey = defaultClient.authentications['apikey'];
apikey.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apikey.apiKeyPrefix['Authorization'] = "Token"
var api = new Otpixel.InstanceResourceApi()
var body = ; // {Instance} Instance description
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.createInstance(body, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class createInstanceExample
{
public void main()
{
// Configure API key authorization: apikey
Configuration.Default.ApiKey.Add("Authorization", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("Authorization", "Bearer");
var apiInstance = new InstanceResourceApi();
var body = new Instance(); // Instance | Instance description
try
{
// Create an instance
Instance result = apiInstance.createInstance(body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling InstanceResourceApi.createInstance: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: apikey
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$api_instance = new Swagger\Client\Api\InstanceResourceApi();
$body = ; // Instance | Instance description
try {
$result = $api_instance->createInstance($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling InstanceResourceApi->createInstance: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::InstanceResourceApi;
# Configure API key authorization: apikey
$WWW::SwaggerClient::Configuration::api_key->{'Authorization'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$WWW::SwaggerClient::Configuration::api_key_prefix->{'Authorization'} = "Bearer";
my $api_instance = WWW::SwaggerClient::InstanceResourceApi->new();
my $body = WWW::SwaggerClient::Object::Instance->new(); # Instance | Instance description
eval {
my $result = $api_instance->createInstance(body => $body);
print Dumper($result);
};
if ($@) {
warn "Exception when calling InstanceResourceApi->createInstance: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: apikey
swagger_client.configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# swagger_client.configuration.api_key_prefix['Authorization'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.InstanceResourceApi()
body = # Instance | Instance description
try:
# Create an instance
api_response = api_instance.create_instance(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling InstanceResourceApi->createInstance: %s\n" % e)
Parameters
Name | Description |
---|---|
body * |