createAttachment
createAttachment
Creates a new attachment.
/ccmweb/rest/repos/{repo}/databases/{database}/records/{recordType}/{recordId}/attachmentFields2/{fieldName}
Usage and SDK Samples
curl -X POST -H "Authorization: [[apiKey]]" "https://192.168.1.245:8190/ccmweb/rest/repos/{repo}/databases/{database}/records/{recordType}/{recordId}/attachmentFields2/{fieldName}"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.AttachmentsApi;
import java.io.File;
import java.util.*;
public class AttachmentsApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: Authorization
ApiKeyAuth Authorization = (ApiKeyAuth) defaultClient.getAuthentication("Authorization");
Authorization.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Authorization.setApiKeyPrefix("Token");
AttachmentsApi apiInstance = new AttachmentsApi();
Attachment attachment = ; // Attachment | Attachment to be created
String database = database_example; // String | Database Name
String fieldName = fieldName_example; // String | Attachment Field name
String recordId = recordId_example; // String | Record ID
String recordType = recordType_example; // String | Record Type
String repo = repo_example; // String | Schema Repository Name
Object actionName = ; // Object | Action to be used to modify the Record.
Object operation = ; // Object | The operation mode. If none is specified then Commit is assumed.
Object useDbid = ; // Object | A boolean value to access a record using its database ID rather than its record ID
try {
Attachment result = apiInstance.createAttachment(attachment, database, fieldName, recordId, recordType, repo, actionName, operation, useDbid);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AttachmentsApi#createAttachment");
e.printStackTrace();
}
}
}
import io.swagger.client.api.AttachmentsApi;
public class AttachmentsApiExample {
public static void main(String[] args) {
AttachmentsApi apiInstance = new AttachmentsApi();
Attachment attachment = ; // Attachment | Attachment to be created
String database = database_example; // String | Database Name
String fieldName = fieldName_example; // String | Attachment Field name
String recordId = recordId_example; // String | Record ID
String recordType = recordType_example; // String | Record Type
String repo = repo_example; // String | Schema Repository Name
Object actionName = ; // Object | Action to be used to modify the Record.
Object operation = ; // Object | The operation mode. If none is specified then Commit is assumed.
Object useDbid = ; // Object | A boolean value to access a record using its database ID rather than its record ID
try {
Attachment result = apiInstance.createAttachment(attachment, database, fieldName, recordId, recordType, repo, actionName, operation, useDbid);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AttachmentsApi#createAttachment");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure API key authorization: (authentication scheme: Authorization)
[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"];
Attachment *attachment = ; // Attachment to be created
String *database = database_example; // Database Name
String *fieldName = fieldName_example; // Attachment Field name
String *recordId = recordId_example; // Record ID
String *recordType = recordType_example; // Record Type
String *repo = repo_example; // Schema Repository Name
Object *actionName = ; // Action to be used to modify the Record. (optional)
Object *operation = ; // The operation mode. If none is specified then Commit is assumed. (optional)
Object *useDbid = ; // A boolean value to access a record using its database ID rather than its record ID (optional)
AttachmentsApi *apiInstance = [[AttachmentsApi alloc] init];
// createAttachment
[apiInstance createAttachmentWith:attachment
database:database
fieldName:fieldName
recordId:recordId
recordType:recordType
repo:repo
actionName:actionName
operation:operation
useDbid:useDbid
completionHandler: ^(Attachment output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var CcmRestApi = require('ccm_rest_api');
var defaultClient = CcmRestApi.ApiClient.instance;
// Configure API key authorization: Authorization
var Authorization = defaultClient.authentications['Authorization'];
Authorization.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Authorization.apiKeyPrefix['Authorization'] = "Token"
var api = new CcmRestApi.AttachmentsApi()
var attachment = ; // {Attachment} Attachment to be created
var database = database_example; // {String} Database Name
var fieldName = fieldName_example; // {String} Attachment Field name
var recordId = recordId_example; // {String} Record ID
var recordType = recordType_example; // {String} Record Type
var repo = repo_example; // {String} Schema Repository Name
var opts = {
'actionName': , // {Object} Action to be used to modify the Record.
'operation': , // {Object} The operation mode. If none is specified then Commit is assumed.
'useDbid': // {Object} A boolean value to access a record using its database ID rather than its record ID
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.createAttachment(attachment, database, fieldName, recordId, recordType, repo, opts, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class createAttachmentExample
{
public void main()
{
// Configure API key authorization: Authorization
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 AttachmentsApi();
var attachment = new Attachment(); // Attachment | Attachment to be created
var database = database_example; // String | Database Name
var fieldName = fieldName_example; // String | Attachment Field name
var recordId = recordId_example; // String | Record ID
var recordType = recordType_example; // String | Record Type
var repo = repo_example; // String | Schema Repository Name
var actionName = new Object(); // Object | Action to be used to modify the Record. (optional)
var operation = new Object(); // Object | The operation mode. If none is specified then Commit is assumed. (optional)
var useDbid = new Object(); // Object | A boolean value to access a record using its database ID rather than its record ID (optional)
try
{
// createAttachment
Attachment result = apiInstance.createAttachment(attachment, database, fieldName, recordId, recordType, repo, actionName, operation, useDbid);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling AttachmentsApi.createAttachment: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: Authorization
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\AttachmentsApi();
$attachment = ; // Attachment | Attachment to be created
$database = database_example; // String | Database Name
$fieldName = fieldName_example; // String | Attachment Field name
$recordId = recordId_example; // String | Record ID
$recordType = recordType_example; // String | Record Type
$repo = repo_example; // String | Schema Repository Name
$actionName = ; // Object | Action to be used to modify the Record.
$operation = ; // Object | The operation mode. If none is specified then Commit is assumed.
$useDbid = ; // Object | A boolean value to access a record using its database ID rather than its record ID
try {
$result = $api_instance->createAttachment($attachment, $database, $fieldName, $recordId, $recordType, $repo, $actionName, $operation, $useDbid);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AttachmentsApi->createAttachment: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::AttachmentsApi;
# Configure API key authorization: Authorization
$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::AttachmentsApi->new();
my $attachment = WWW::SwaggerClient::Object::Attachment->new(); # Attachment | Attachment to be created
my $database = database_example; # String | Database Name
my $fieldName = fieldName_example; # String | Attachment Field name
my $recordId = recordId_example; # String | Record ID
my $recordType = recordType_example; # String | Record Type
my $repo = repo_example; # String | Schema Repository Name
my $actionName = ; # Object | Action to be used to modify the Record.
my $operation = ; # Object | The operation mode. If none is specified then Commit is assumed.
my $useDbid = ; # Object | A boolean value to access a record using its database ID rather than its record ID
eval {
my $result = $api_instance->createAttachment(attachment => $attachment, database => $database, fieldName => $fieldName, recordId => $recordId, recordType => $recordType, repo => $repo, actionName => $actionName, operation => $operation, useDbid => $useDbid);
print Dumper($result);
};
if ($@) {
warn "Exception when calling AttachmentsApi->createAttachment: $@\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: Authorization
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.AttachmentsApi()
attachment = # Attachment | Attachment to be created
database = database_example # String | Database Name
fieldName = fieldName_example # String | Attachment Field name
recordId = recordId_example # String | Record ID
recordType = recordType_example # String | Record Type
repo = repo_example # String | Schema Repository Name
actionName = # Object | Action to be used to modify the Record. (optional)
operation = # Object | The operation mode. If none is specified then Commit is assumed. (optional)
useDbid = # Object | A boolean value to access a record using its database ID rather than its record ID (optional)
try:
# createAttachment
api_response = api_instance.create_attachment(attachment, database, fieldName, recordId, recordType, repo, actionName=actionName, operation=operation, useDbid=useDbid)
pprint(api_response)
except ApiException as e:
print("Exception when calling AttachmentsApi->createAttachment: %s\n" % e)
Parameters
Name | Description |
---|---|
database* |
String
Database Name
Required
|
fieldName* |
String
Attachment Field name
Required
|
recordId* |
String
Record ID
Required
|
recordType* |
String
Record Type
Required
|
repo* |
String
Schema Repository Name
Required
|
Name | Description |
---|---|
attachment * |
Name | Description |
---|---|
actionName |
Object
Action to be used to modify the Record.
|
operation |
Object
The operation mode. If none is specified then Commit is assumed.
|
useDbid |
Object
A boolean value to access a record using its database ID rather than its record ID
|