Upload a file attachment for an entity.
POST
/api/workspace/attachments
using System.Net.Http.Headers;var client = new HttpClient();var request = new HttpRequestMessage{ Method = HttpMethod.Post, RequestUri = new Uri("https://example.com/api/workspace/attachments"), Content = new MultipartFormDataContent { new StringContent("") { Headers = { ContentType = new MediaTypeHeaderValue("application/octet-stream"), ContentDisposition = new ContentDispositionHeaderValue("form-data") { Name = "File", FileName = "file", } } }, new StringContent("example") { Headers = { ContentType = new MediaTypeHeaderValue("text/plain"), ContentDisposition = new ContentDispositionHeaderValue("form-data") { Name = "Description", } } }, new StringContent("example") { Headers = { ContentType = new MediaTypeHeaderValue("text/plain"), ContentDisposition = new ContentDispositionHeaderValue("form-data") { Name = "OwnerResourceKind", } } }, new StringContent("example") { Headers = { ContentType = new MediaTypeHeaderValue("text/plain"), ContentDisposition = new ContentDispositionHeaderValue("form-data") { Name = "OwnerModuleKey", } } }, new StringContent("example") { Headers = { ContentType = new MediaTypeHeaderValue("text/plain"), ContentDisposition = new ContentDispositionHeaderValue("form-data") { Name = "OwnerContextResourceId", } } }, new StringContent("example") { Headers = { ContentType = new MediaTypeHeaderValue("text/plain"), ContentDisposition = new ContentDispositionHeaderValue("form-data") { Name = "OwnerResourceObjectId", } } }, new StringContent("example") { Headers = { ContentType = new MediaTypeHeaderValue("text/plain"), ContentDisposition = new ContentDispositionHeaderValue("form-data") { Name = "RelationsJson", } } }, },};using (var response = await client.SendAsync(request)){ response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);}const url = 'https://example.com/api/workspace/attachments';const form = new FormData();form.append('File', 'file');form.append('Description', 'example');form.append('OwnerResourceKind', 'example');form.append('OwnerModuleKey', 'example');form.append('OwnerContextResourceId', 'example');form.append('OwnerResourceObjectId', 'example');form.append('RelationsJson', 'example');
const options = {method: 'POST'};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/workspace/attachments \ --header 'Content-Type: multipart/form-data' \ --form File=@file \ --form Description=example \ --form OwnerResourceKind=example \ --form OwnerModuleKey=example \ --form OwnerContextResourceId=example \ --form OwnerResourceObjectId=example \ --form RelationsJson=exampleAuthorizations
Section titled “Authorizations”- None
Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”access_token
string
Optional access token for clients that cannot set Authorization headers. Prefer Authorization: Bearer <token> when possible.
Request Body
Section titled “Request Body”Media typemultipart/form-data
object
File
string format: binary
Description
string
OwnerResourceKind
string
OwnerModuleKey
string
OwnerContextResourceId
string
OwnerResourceObjectId
string
RelationsJson
string
Responses
Section titled “Responses”OK
Media typeapplication/json
object
Data
object
FileReferenceId
string
DescriptorId
string
ChecksumSha256
string
SizeBytes
integer format: int64
MimeType
string
Errors
Array<object>
object
Code
required
string
Message
required
string
Target
string
Field
string
Metadata
object
key
additional properties
string
Type
integer format: int32
Severity
integer format: int32
Warnings
Array<object>
object
Code
required
string
Message
required
string
Target
string
Field
string
Metadata
object
key
additional properties
string
Type
integer format: int32
Severity
integer format: int32
Success
boolean
Example
{ "Errors": [ { "Type": 0, "Severity": 0 } ], "Warnings": [ { "Type": 0, "Severity": 0 } ]}Bad Request
Media typeapplication/json
object
Data
object
FileReferenceId
string
DescriptorId
string
ChecksumSha256
string
SizeBytes
integer format: int64
MimeType
string
Errors
Array<object>
object
Code
required
string
Message
required
string
Target
string
Field
string
Metadata
object
key
additional properties
string
Type
integer format: int32
Severity
integer format: int32
Warnings
Array<object>
object
Code
required
string
Message
required
string
Target
string
Field
string
Metadata
object
key
additional properties
string
Type
integer format: int32
Severity
integer format: int32
Success
boolean
Example
{ "Errors": [ { "Type": 0, "Severity": 0 } ], "Warnings": [ { "Type": 0, "Severity": 0 } ]}Forbidden
Media typeapplication/json
object
type
string
title
string
status
integer format: int32
detail
string
instance
string
key
additional properties
Examplegenerated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example"}Not Found
Media typeapplication/json
object
Data
object
FileReferenceId
string
DescriptorId
string
ChecksumSha256
string
SizeBytes
integer format: int64
MimeType
string
Errors
Array<object>
object
Code
required
string
Message
required
string
Target
string
Field
string
Metadata
object
key
additional properties
string
Type
integer format: int32
Severity
integer format: int32
Warnings
Array<object>
object
Code
required
string
Message
required
string
Target
string
Field
string
Metadata
object
key
additional properties
string
Type
integer format: int32
Severity
integer format: int32
Success
boolean
Example
{ "Errors": [ { "Type": 0, "Severity": 0 } ], "Warnings": [ { "Type": 0, "Severity": 0 } ]}