Hello everyone,
for migration of data to an A12 system (<PROJECT_NAME>) I need to transfer attachments from another (non-A12) system. For the “normal” documents there is the JSON-RPC endpoint where I can upload multiple documents at once. For attachments, there seems to be no such thing.
-
Is there a best practice on how to upload many attachments at once?
-
In the doc for the attachments REST API (GetA12 Login) it says you have to save the document after the upload - which API endpoint do I need to use for that?
Thanks,
Guido
Hi @guido-quiet-root,
Unfortunately there is functionality available right now nor is it planned for the future with <INTERNAL_LINK> Please create a ticket for this feature and we will take a look.
Unfortunately there is (no) functionality available right now nor is it planned for the future …
@tomas-thin-gale : I think (hope) this answers question 1 - what about the 2nd one? Is there any remote API to “save” the document?
Each attachment gets a unique UUID after it is created (using /attachment/upload endpoint) this UUID is then returned back to as a response of the upload requests. A Document can then be created or modified using this attachment UUID as a reference using ADD_DCUMENT or MODIFIDY_DOCUMENT JSON-RPC methods.
This is the example of document creation with attachment assignment.
{
"jsonrpc": "2.0",
"id": "AddDocumentWithAttachment",
"method": "ADD_DOCUMENT",
"params": {
"document": {
"Product": {
"name": "Document with attachment",
"attachment1": {
"original_filename": "",
"internal_filename": "internal",
"content": "",
"attachment_id": "{{ATTACHMENT_UUID}}",
"size": "",
"mime_type": "jpeg",
"category": "",
"description": ""
}
}
},
"documentModelName": "ModelWithAttachment",
"locale": "en"
}
}
The Answer valid for Data services 32.2.0 to 34.0.0
@tomas-thin-gale : Thank you, I will look into it.