POST alfresco data to ODOO ERP

Showing results for 
Search instead for 
Did you mean: 
Active Member II

POST alfresco data to ODOO ERP


I created a folder rule that executes a JS script.

In this script, i'm trying to POST the document's ID in ODOO api using the following code:

var nid =['cm:nid'];

var url = "http://localhost../api/alfresco/create";
var data = { "node_id": nid };
var headers = {
    "Content-Type": "application/json",
    "Accept": "application/json"

var http = new;
var post = new;

post.setRequestEntity(new, "application/json", "UTF-8"));

for (var key in headers) {
    if (headers.hasOwnProperty(key)) {
        post.addRequestHeader(key, headers[key]);

try {
    var status = http.executeMethod(post);
    logger.log("API response status: " + status);
    logger.log("API response body: " + post.getResponseBodyAsString());
} catch (ex) {
    logger.log("Error sending POST request to API: " + ex);
} finally {

I tested this script in Javascript Console it works good, but when i try to execute it when adding a document, it shows the following error:

Sans titre.png

What might be the problem here? Am I using the wrong packages?

1 Reply

Re: POST alfresco data to ODOO ERP

Please check alfresco log. There you will get idea why it is failing.