You can use the Transformations API to set up file format transformations, such as converting Word files to PDF/A. A transformation configuration tells the archive which file formats to convert, how, and into what kind of representation.
Every call needs the headers in Common headers.
How a transformation runs
Your transformation configurations decide what the archive converts. Transformations run as part of the formatPreservation preservation action, after the archive has identified the file formats. For each representation of the package, the archive:
-
Checks the file format of the representation's first file.
-
Finds the enabled transformation configurations that have this format in
sourceFormats, and that apply to the package's archive profile. -
Converts the representation's files with the configuration's engine, and adds the result to the package as another representation of the type in
targetType.
The new representation has the original name, with the targetExtension as its extension. If the package already has a representation with that name, the archive skips the conversion.
To run the transformations on packages that are already in the archive, run formatPreservation with the Preservation actions API.
List file formats
Returns the file formats that the archive knows. Use the puid values in sourceFormats.
GET /v2/transformations/formats
Required role: archive-content-manager
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
string |
No |
Only the formats whose name or PUID contains this text. Not case-sensitive. |
Response: 200 OK with an array of FileFormat. The list isn't split into pages.
curl "https://archive.example.com/v2/transformations/formats?filter=word" \
-H "Authorization: Bearer $TOKEN" \
-H "tenant: example-tenant"
[
{
"puid": "fmt/40",
"name": "Microsoft Word Document",
"version": "97-2003",
"mimeType": "application/msword",
"extensions": ["doc"]
}
]
List transformation configurations
GET /v2/transformations/configs
Required role: archive-content-manager
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
integer |
No |
The page number, starting at 0. Default: |
|
|
integer |
No |
The number of configurations per page. Default: |
Response: 200 OK with a TransformationConfigList, sorted by name.
Get a transformation configuration
GET /v2/transformations/configs/{configId}
Required role: archive-content-manager
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
string |
Yes |
The ID of the transformation configuration. |
Response: 200 OK with a TransformationConfig.
-
404: there's no transformation configuration with this ID.
Create a transformation configuration
Sets up a transformation. The archive uses it the next time it runs formatPreservation on a package.
POST /v2/transformations/configs
Required role: archive-content-manager
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
string |
Yes |
The name of the configuration. |
|
|
array of strings |
Yes |
The PUIDs of the formats to convert, for example |
|
|
string |
Yes |
A label for the format that you convert to, for example |
|
|
string |
Yes |
The extension of the result, without a dot, for example |
|
|
string |
Yes |
The type of the extra representation: |
|
|
Yes |
The engine that converts the files. |
|
|
|
array of strings |
No |
The |
|
|
boolean |
No |
If |
{
"name": "Word to PDF/A",
"sourceFormats": ["fmt/40", "fmt/412"],
"targetFormat": "PDF/A-1b",
"targetExtension": "pdf",
"targetType": "preservation",
"transformation": {
"engine": "word2pdf"
},
"enabled": true
}
Response: 200 OK with the TransformationConfig.
-
400withUNSUPPORTED_VALUE:targetTypeisn't one of the allowed types. -
400withREQUIRED_FIELD: a required field is missing.
Update a transformation configuration
Replaces the configuration with the body that you send. The body has the same fields as Create a transformation configuration, so send all of them.
PUT /v2/transformations/configs/{configId}
Required role: archive-content-manager
Response: 200 OK with the updated TransformationConfig. The change applies to the next runs. Representations that the archive already created stay as they are.
-
404: there's no transformation configuration with this ID. -
The
400errors of Create a transformation configuration.
Delete a transformation configuration
DELETE /v2/transformations/configs/{configId}
Required role: archive-content-manager
Response: 204 No Content. Representations that the configuration already created stay in their packages.
-
404: there's no transformation configuration with this ID.
Schemas
TransformationEngine
|
Field |
Type |
Description |
|---|---|---|
|
|
string |
The engine. See the list after this table. |
|
|
string |
For |
The engine values are:
-
word2pdf: Word to PDF/A-1b. -
dwg2pdfa: DWG drawings to PDF/A-1b. -
tiff2jpeg: TIFF to JPEG. -
conversion: the general conversion engine.
TransformationConfig
|
Field |
Type |
Description |
|---|---|---|
|
|
string |
The ID of the configuration. |
|
|
string |
The name of the configuration. |
|
|
array of strings |
The PUIDs of the formats that it converts. |
|
|
string |
The label of the format that it converts to. |
|
|
string |
The extension of the result. |
|
|
string |
The type of the representation that it creates. |
|
|
The engine that converts the files. |
|
|
|
array of strings |
The |
|
|
boolean |
Whether the archive uses the configuration. |
|
|
string (date-time) |
When the configuration was created. |
TransformationConfigList
|
Field |
Type |
Description |
|---|---|---|
|
|
number |
The number of configurations. |
|
|
number |
The page number. |
|
|
number |
The page size. |
|
|
array of TransformationConfig |
The configurations in the page of results. |
FileFormat
|
Field |
Type |
Description |
|---|---|---|
|
|
string |
The PRONOM unique identifier, for example |
|
|
string |
The name of the format. |
|
|
string |
The version of the format, if PRONOM defines one. |
|
|
string |
The MIME type, if known. |
|
|
array of strings |
The file extensions of the format. |