I'm trying to perform a multiple element GET request from an alfresco database of elements. The way we have it set up is if a GET request is made with a body, it will return the elements listed in the body. I have the following code, and everything works as it should up until the URLFetch
:
Begin["`Private`"];
getElements[server_,branch_,site_,elementIDs_]:=(
(*elementIDs is a list of strings*)
url=StringJoin[server,"/alfresco/service/workspaces/",branch,"/elements"]
; assoc=<|"elements"->Association/@Thread["id"->elementIDs]|>
; jsonElements = ExportString[assoc,"RawJSON"]
; Return @ URLFetch[
url
, "Method"->"GET"
, "Body"->jsonElements
, "Headers"->{
"Content-Type"->"application/json;charset=UTF-8"
, "Content-Length"->"0"
, "Accept"->"application/json;charset=UTF-8"
}
];
)
End[];
I would like to use URLExecute
, but it returns the following error:
Import::fmterr: Cannot import data as JSON format.
When using URLFetch
, it is returning "Could not complete DB transaction, see Alfresco logs for details."
I dont know if it's a problem with my code, Mathematica, or the api.