Hola a todos,
Estoy intentando modificar los metadatos de un documento a través de la REST API de Alfresco. Realizo la llamada correctamente y me devuelve "success": true. Pero cuando voy al documento no me ha modificado ningún dato. Mi código es el siguiente:
try {
HttpClient client = new HttpClient();
String uploadUrl = "http://00.00.00.00:8080/alfresco/service/api/metadata/node/workspace/SpacesStore/e8ab1cf6-64ee-46f8-b6ad-4d1e7524844d?alf_ticket=" + ticket;
PostMethod post = new PostMethod(uploadUrl);
JSONObject metadatos = new JSONObject();
metadatos.put("title", "SELA");
metadatos.put("description", "SELA");
JSONObject properties = new JSONObject();
properties.put("properties", metadatos);
StringRequestEntity requestEntity = new StringRequestEntity(
properties.toString(),
"application/json",
"UTF-8");
post.setDoAuthentication(true);
post.setRequestHeader("Content-Type", "application/json");
post.setRequestEntity(requestEntity);
int status = client.executeMethod(post);
System.out.println(post.getResponseBodyAsString());
post.releaseConnection();
if (status != HttpStatus.SC_OK) {
System.err.println("Method failed: " + post.getStatusLine());
}
} catch (IOException e) {
e.printStackTrace();
}Y el JSON que estoy generando y enviando es este:
{
"properties": {
"cm:title": "SELA",
"cm:description": "SELA"
}
}URL que estoy enviando:
http://00.00.00.00:8080/alfresco/service/api/metadata/node/workspace/SpacesStore/e8ab1cf6-64ee-46f8-b6ad-4d1e7524844d?TICKET_123...
La verdad no veo cual puede ser el problema. ¿Estoy construyendo mal el JSON? o ¿Hay algo que esté haciendo mal?
Os agradecería cualquier ayuda.
Muchas gracias.