cancel
Showing results for 
Search instead for 
Did you mean: 

declaring records programatically using any API

marianov
Champ in-the-making
Champ in-the-making
Hello. I'm trying to file records into RM from an external application, but I haven't yet find out how to do it.
If I understand correctly, in order to declare a record from scratch one has to :
1) create the folder in RM
2) upload or move a the file to that folder (can be done via CIFS/DAV/etc)
3) set the mandatory metadata values for the file
4) call the "declare as record" action.

I would like to do 3) and 4) programatically, either from a webscript or by calling a REST API, so that I can for example have a PHP application file and declare records.

Is this possible or RM is only intended for interactive use from inside Share? Is there any example code?
I googled for this but found nothing, and there are several similar unanswered questions in this forum.
I though this would be doable with CMIS, but since it does not support aspects, I think it's not.

Thanks

Mariano
3 REPLIES 3

erikwinlof
Confirmed Champ
Confirmed Champ
Yes there is a way. You can achieve the same result by…

#3 - by doing the same call that Share is doing when updating the mandatory fields for the document:

POST http://localhost:8080/share/proxy/alfresco/api/node/workspace/SpacesStore/0c9abac8-a4b4-46e1-854b-e8...
{
  "prop_cm_name":"pgadmin.log",
  "prop_cm_title":"PG Admin Log",
  "prop_cm_description":"",
  "prop_cm_author":"",
  "prop_mimetype":"text/plain",
  "prop_rma_originator":"Hello",
  "prop_rma_originatingOrganization":"Erik",
  "prop_rma_publicationDate":"2011-06-16T00:00:00.000+02:00",
  "prop_rma_location":"", 
  "prop_rma_mediaType":"",
  "prop_rma_format":"",
  "prop_rma_dateReceived":"",
  "prop_rma_address":"",
  "prop_rma_otherAddress":"",
  "prop_rmc_supplementalMarkingList":""
}

…and…

#4 - by doing the same call that  Share does when declaring a document to be a record:

POST http://localhost:8080/share/proxy/alfresco/api/rma/actions/ExecutionQueue
{
   "name":"declareRecord",
   "nodeRef":"workspace://SpacesStore/0c9abac8-a4b4-46e1-854b-e8fa432329f3"
}

PS1. If you want to do the upload, field update and record declaration in one single transaction you will have to create your own repository webscript that does them all for a single REST call.

PS2.
If you want to call the repository directly you can do so by changing the beginning of the url.
Simply change:
http://localhost:8080/share/proxy/alfresco/
to:
http://localhost:8080/alfresco/service/

PS3. If you want to browse the available REST calls for RM, navigate to your alfresco respository and check out the webscripts:
http://localhost:8080/alfresco/service/index/uri/
The ones starting with "api/rma/" relate to Records Management.

PS4. If you can't find any docs for a certain thing but wants to know how Share is doing it, I suggest you download FireFox and install the HttpFox addon to see the HTTP/REST calls that Share is doing against the respository.

Good luck.

marianov
Champ in-the-making
Champ in-the-making
Thanks! I've been struggling with this for weeks!

Mariano

agovikar
Champ in-the-making
Champ in-the-making
Hi,

I am getting AccessDeniedException while trying to call the rest api http://localhost:8080/alfresco/service/api/rma/actions/ExecutionQueue?alf_ticket=TICKET_545cadeec4c4... to declare the document as record programatically, even though I am able to declare the record by logging into Alfresco Share Records Management manuallly. Can anyone please help.

{
"name":"declareRecord",
"nodeRef":"workspace://SpacesStore/9418526e-496c-4789-8d4a-2002d66c8ed3"
}

Same exception even if I add the params object to the above request.

params:{"prop_cm_name":"Contract_Signed.pdf",

"prop_cm_title":"Contract_Signed",
"prop_cm_description":"",
"prop_cm_author":"",
"prop_mimetype":"application/pdf",
"prop_rma_originator":"ABC",
"prop_rma_originatingOrganization":"XYZ",
"prop_rma_publicationDate":"",
"prop_rma_location":"",
"prop_rma_mediaType":"",
"prop_rma_format":"",
"prop_rma_dateReceived":"",
"prop_rma_address":"",
"prop_rma_otherAddress":"",
"prop_rmc_supplementalMarkingList":""
}
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.