Skip to main content

Attachments

Those endpoints allow you to manipulate attachments for every type of object that can own some in Retail Operations (Document, Project, ...)

Definition

Attachments are every file that can be added in the solution: document picture, company logo, email attachment, ....

All the attachments are read only, you can change certain properties of an attachment but the file itself can never be changed.
If you want to change a file you have to upload a new attachment and then remove the one you wanted to replace.

Identifier

The attachment identifying key is composed of 5 informations:

Key componentDescription
objectTypeIDThe type of the object (cf.Object types)
Ex: Project, Document, Client, ...
entityTypeIDThe type of the entity, this value signification depends on the type of object
entityIDThe ID of the entity
attachmentIDThe ID of the physical file
attachmentIndexThe Index of the file, used in case you may have the same file attached multiple times to the same entity

The objectTypeID, entityTypeID and entityID identify the entity.
The attachmentID and attachmentIndex identify an attachment on the entity.

Object types

IDNameComment
1Contact
2Project
3Document
4TaskAlso called Event in the API
5Email
6Product
7Promotion
8Catalog
9Employee
10EmailSignature
11Warehouse
12Workflow
13Payment
14Style
15StyleTypeAlso called Style Feature
16StyleInfoAlso called Style Feature Option
17EditionAnnexes

Attachment link types are used to define the global type of an attachment.

Each link type can be assigned a maximum number of attachments. This value will limit the number of attachments of this link type on a same given entity.
When the Max Number set on a Link type is 1, then adding a new Attachment of this link type on an entity that already owns one will automatically delete the already present attachment, in order to respect the limit.
Ex: "Logo" limit = 1,. If an attachment with "Logo" link type already exists on a product, and if you add a new attachment with "Logo" type to this product, then the new attachment is added and the old one is automatically removed.

  • * -> no auto remove
  • 1 -> auto remove existing attachment on new attachment upload
IDNameMax NumberComment
0List*A general list of attachments
1Logo1The logo
Ex: Product, Contact main logos
2Banner1Reserved
3FrontPageJson1Reserved
4HtmlBody1Reserved
5Unique1Reserved
6DataSource1Reserved

Tags

You can add tags to attachments in order to include standardized information.
Certain tags are mutually exclusive: e.g. all tags in the same categoryID are mutually exclusive.
All tags not documented here are internal and reserved tags, and should not be used or changed.

IDNameCategoryIDComment
1Conception1
2CoveringPanels1
5EDI.edi and ORDER.zip edi files
6EDIGraphEdi graph files
7EDILogisticLogistics (INSDES) edi file
8EDIOriginFileUsed to mark which file should be used to generate the EDIGraph file
10Elevation1
11Excelused for .xls and .xlsx files
16Module1
17OtherMisc tag
18Perspective1
19Pictureused to identify "jpeg", "jpg", "wmf", "emf", "bmp", "png", "gif" files
20Plan1
23RoomIdentify the project save file of the configurator
24SignedDocumentFor the pdf document that have been electronically signed
28Thumbnail1
31WorkTop1
32ZIPall zip files
34HQRender1

Categories:

  • 1: Used to classify images generated by a configurator

Upload process

To upload a new file, you need to follow a 3 steps process:

This is necessary as we internal deduplicate files.

Start

First you need to compute the sha256 of the file and get its size.
Then you can call the AttachmentAddStart endpoint with all the details of the attachment you want to add.
Then there are 2 possibilities, depending on the response needUpload property value:

  • if needUpload is false, then the upload process stops here. As we already own this exact file, you do not need to upload it again.
    You can find the detail of the linked attachment in the response attachment properties.
  • if needUpload is true, then continue to the Upload step.

Upload

The second step (if needUpload == true) allows you to upload the file.
You just need to process a PUT request call at the url provided in the uploadUrl properties, with the raw file content as the request body.

Finish

The third step after the Upload is to call the Finish endpoint, in order to tell the webservice that you have finished uploading the file. The webservice will check that the file upload corresponds with the information you have provided and then will link the file to the entity.
In response you will find the detail of the attachment.


Attachment Structure

{
"objectTypeID": long,
"entityTypeID": long,
"entityID": long,
"id": long,
"index": int,
"url": string,
"date": string,
"linkTypeID": long,
"name": string,
"extension": string,
"size": long,
"checksum": string,
"externalApplicationID": long,
"conceptionID": long,
"isFavorite": bool,
"tags": long[]
}
NameComment
objectTypeIDID of the type of object on which this attachment is present
entityTypeIDID of the type of entity on which this attachment is present
entityIDID of the entity on which this attachment is present
idID of the file itself
indexIndex of this attachment on the entity
urlURL to access this attachment
date
linkTypeIDLink type between the attachment and the entity
nameName of the file without extension
extensionExtension of the file without the leading "." and lower case
sizeSize in bytes of the file
checksumString representation of the SHA256 of the file as a hexadecimal
externalApplicationIDID of the application that generated this file
conceptionIDID of the conception the file is extracted from.
Only present and used for "Document" object type.
isFavoritetrue if this is the favorite image of the entity.
Only used on "list" link type and on certain object (project / document), to choose the thumbnail.
Only 1 favorite attachment is allowed at the same time.
tagsList of tag IDs for this attachment

Attachment methods

List

Returns the list of attachments of a specified entity.

Method

GET/api/externals/v1/attachments/{objectTypeID}/{entityTypeID}/{entityID}

Arguments

  • objectTypeID (long): (provided in the path): ID of the target object type
  • entityTypeID (long): (provided in the path): ID of the target entity type
  • entityID (long): (provided in the path): ID of the entity owning the attachments to List
  • winLangID (long): Windows Language Identifier of the resulting data

Body

(none)

Response

The list method returns a JSON message with the list of items:

{
"attachments": [
{
"objectTypeID": long,
"entityTypeID": long,
"entityID": long,
"id": long,
"index": int,
"url": string,
"date": string,
"linkTypeID": long,
"name": string,
"extension": string,
"size": long,
"checksum": string,
"externalApplicationID": long,
"conceptionID": long,
"isFavorite": bool,
"tags": long[] // List of tag IDs
}
],
"success": boolean,
"message": string,
"rowCount": long
}

See Attachment Structure


Add Start

Starts the 3 steps process to Add an attachment

Method

POST/api/externals/v1/attachments/{objectTypeID}/{entityTypeID}/{entityID}

Arguments

  • objectTypeID (long): (provided in the path): ID of the target object type
  • entityTypeID (long): (provided in the path): ID of the target entity type
  • entityID (long): (provided in the path): ID of the entity that will own the attachment to be added

Body

The details of the attachment to be added:

{
"linkTypeID": long,
"name": string,
"extension": string,
"size": long,
"checksum": string,
"externalApplicationID": long,
"conceptionID": long,
"isFavorite": bool,
"tags": long[] // List of tag IDs
}

For detail on the fields see: Attachment Structure.
Highlighted fields are mandatory.

Response

The Add Start method returns a JSON message with the information of the added attachment or the information needed in order to complete the Upload process:

{
"success": boolean,
"message": string,
"rowCount": long,
"needUpload": bool,
"uploadUrl": string,
"transactionID": string,
"attachment": AttachmentDetail // same as List endpoint
}
NameComment
needUploadIf true: you need to complete the full Upload process.
Else if false: we already own this file and we have attached it.
You can find the details of the attached file in the attachment property.
uploadUrlIf needUpload == true: the url where to upload the file (Step 2 Upload).
transactionIDIf needUpload == true: ID of the Add attachment transaction to be passed to the Finish endpoint after the upload is completed.
attachmentOnly present if needUpload == false: a single AttachmentDetail that has the same properties as those in the List method response.

Finish add attachment

Step 3: Finish step of the add an attachment process.
Links a temporary upload to the entity.

Method

POST/api/externals/v1/attachments/{objectTypeID}/{entityTypeID}/{entityID}/finish/{transactionID}

Arguments

  • objectTypeID (long): (provided in the path): ID of the target object type
  • entityTypeID (long): (provided in the path): ID of the target entity type
  • entityID (long): (provided in the path): ID of the entity owning the attachment to be added
  • transactionID (long): (provided in the path): ID of the Add attachment transaction, given by the Add Start endpoint

Body

The attachment detail to add.
Should be the same as the one given in the Add Start endpoint.

See Add start Body

Response

The Add Finish method returns a JSON message with the information of the added attachment:

{
"success": boolean,
"message": string,
"rowCount": long,
"attachment": AttachmentDetail // same as List endpoint
}
NameComment
attachmentA single AttachmentDetail that has same properties as those in the List Response.

Delete attachment

Deletes the attachment on an entity.

Method

DELETE/api/externals/v1/attachments/{objectTypeID}/{entityTypeID}/{entityID}/{attachmentID}/{attachmentIndex}

Arguments

  • objectTypeID (long): (provided in the path): ID of the target object type
  • entityTypeID (long): (provided in the path): ID of the target entity type
  • entityID (long): (provided in the path): ID of the entity owning the attachment to be removed
  • attachmentID (long): (provided in the path): ID of the attachment to be removed
  • attachmentIndex (long): (provided in the path): Index of the attachment to be removed on the specified entity

Body

(none)

Response

{
"success": boolean,
"message": string,
"rowCount": long,
}

Update attachment info

Allows you to update certain editable properties on an existing attachment.

Method

PUT/api/externals/v1/attachments/{objectTypeID}/{entityTypeID}/{entityID}/{attachmentID}/{attachmentIndex}

Arguments

  • objectTypeID (long): (provided in the path): ID of the target object type
  • entityTypeID (long): (provided in the path): ID of the target entity type
  • entityID (long): (provided in the path): ID of the entity owning the attachment to be updated
  • attachmentID (long): (provided in the path): ID of the attachment to be updated
  • attachmentIndex (long): (provided in the path): Index of the attachment to be updated on the specified entity

Body

{
"name": string,
"isFavorite": bool,
"tags": long[]
}

Response

{
"success": boolean,
"message": string,
"rowCount": long,
}

Attachment enum methods

Here are the endpoints that give you the possible values for the different enums:

Object types

Returns the list of all available object types that can own attachments.

Method

GET/api/externals/v1/attachments/objectTypes

Arguments

  • winLangID (long): Windows Language Identifier of the resulting data

Body

(none)

Response

{
"success": boolean,
"message": string,
"rowCount": long,
"types": [
{
"id": long, // ID of the object type
"name": string, // Name of the object type
"description": string // Additional description of the object type, if set
}
]
}

Returns the list of all available link types.

Method

GET/api/externals/v1/attachments/types

Arguments

  • winLangID (long): Windows Language Identifier of the resulting data

Body

(none)

Response

{
"success": boolean,
"message": string,
"rowCount": long,
"types": [
{
"id": long, // ID of the link type
"name": string, // Name of the link type
"description": string // Additional description of the link type, if set
}
]
}

Tags

Returns the list of all available tags.

Method

GET/api/externals/v1/attachments/tags

Arguments

  • winLangID (long): Windows Language Identifier of the resulting data

Body

(none)

Response

{
"success": boolean,
"message": string,
"rowCount": long,
"types": [
{
"id": long, // ID of the tag
"name": string, // Name of the tag
"description": string // Additional description of the tag, if set
}
]
}