addAttribute
Add a custom attribute to an object
/attributes/{objectName}
Usage and SDK Samples
curl -X POST -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic [[basicHash]]" "http://localhost:3000/api/scmodel/v1/attributes/{objectName}"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.DefaultApi;
import java.io.File;
import java.util.*;
public class DefaultApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: BasicAuth
HttpBasicAuth BasicAuth = (HttpBasicAuth) defaultClient.getAuthentication("BasicAuth");
BasicAuth.setUsername("YOUR USERNAME");
BasicAuth.setPassword("YOUR PASSWORD");
DefaultApi apiInstance = new DefaultApi();
String objectName = objectName_example; // String | Object name
PropertyDefinition body = ; // PropertyDefinition |
try {
apiInstance.addAttribute(objectName, body);
} catch (ApiException e) {
System.err.println("Exception when calling DefaultApi#addAttribute");
e.printStackTrace();
}
}
}
import io.swagger.client.api.DefaultApi;
public class DefaultApiExample {
public static void main(String[] args) {
DefaultApi apiInstance = new DefaultApi();
String objectName = objectName_example; // String | Object name
PropertyDefinition body = ; // PropertyDefinition |
try {
apiInstance.addAttribute(objectName, body);
} catch (ApiException e) {
System.err.println("Exception when calling DefaultApi#addAttribute");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure HTTP basic authorization (authentication scheme: BasicAuth)
[apiConfig setUsername:@"YOUR_USERNAME"];
[apiConfig setPassword:@"YOUR_PASSWORD"];
String *objectName = objectName_example; // Object name
PropertyDefinition *body = ; //
DefaultApi *apiInstance = [[DefaultApi alloc] init];
[apiInstance addAttributeWith:objectName
body:body
completionHandler: ^(NSError* error) {
if (error) {
NSLog(@"Error: %@", error);
}
}];
var IrisSupplyChainDataModelApi = require('iris_supply_chain_data_model_api');
var defaultClient = IrisSupplyChainDataModelApi.ApiClient.instance;
// Configure HTTP basic authorization: BasicAuth
var BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME'
BasicAuth.password = 'YOUR PASSWORD'
var api = new IrisSupplyChainDataModelApi.DefaultApi()
var objectName = objectName_example; // {String} Object name
var body = ; // {PropertyDefinition}
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
};
api.addAttribute(objectName, body, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class addAttributeExample
{
public void main()
{
// Configure HTTP basic authorization: BasicAuth
Configuration.Default.Username = "YOUR_USERNAME";
Configuration.Default.Password = "YOUR_PASSWORD";
var apiInstance = new DefaultApi();
var objectName = objectName_example; // String | Object name
var body = new PropertyDefinition(); // PropertyDefinition |
try
{
apiInstance.addAttribute(objectName, body);
}
catch (Exception e)
{
Debug.Print("Exception when calling DefaultApi.addAttribute: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure HTTP basic authorization: BasicAuth
Swagger\Client\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
Swagger\Client\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');
$api_instance = new Swagger\Client\Api\DefaultApi();
$objectName = objectName_example; // String | Object name
$body = ; // PropertyDefinition |
try {
$api_instance->addAttribute($objectName, $body);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->addAttribute: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::DefaultApi;
# Configure HTTP basic authorization: BasicAuth
$WWW::SwaggerClient::Configuration::username = 'YOUR_USERNAME';
$WWW::SwaggerClient::Configuration::password = 'YOUR_PASSWORD';
my $api_instance = WWW::SwaggerClient::DefaultApi->new();
my $objectName = objectName_example; # String | Object name
my $body = WWW::SwaggerClient::Object::PropertyDefinition->new(); # PropertyDefinition |
eval {
$api_instance->addAttribute(objectName => $objectName, body => $body);
};
if ($@) {
warn "Exception when calling DefaultApi->addAttribute: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: BasicAuth
swagger_client.configuration.username = 'YOUR_USERNAME'
swagger_client.configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = swagger_client.DefaultApi()
objectName = objectName_example # String | Object name
body = # PropertyDefinition |
try:
api_instance.add_attribute(objectName, body)
except ApiException as e:
print("Exception when calling DefaultApi->addAttribute: %s\n" % e)
Parameters
Path parameters
Name | Description |
---|---|
objectName* |
String
Object name
Required
|
Body parameters
Name | Description |
---|---|
body * |