<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: POST alfresco data to ODOO ERP in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/post-alfresco-data-to-odoo-erp/m-p/145967#M38677</link>
    <description>&lt;P&gt;Please check alfresco log. There you will get idea why it is failing.&lt;/P&gt;</description>
    <pubDate>Mon, 01 May 2023 04:10:15 GMT</pubDate>
    <dc:creator>sp2</dc:creator>
    <dc:date>2023-05-01T04:10:15Z</dc:date>
    <item>
      <title>POST alfresco data to ODOO ERP</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/post-alfresco-data-to-odoo-erp/m-p/145966#M38676</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I created a folder rule that executes a JS script.&lt;/P&gt;&lt;P&gt;In this script, i'm trying to POST the document's ID in ODOO api using the following code:&lt;/P&gt;&lt;PRE&gt;var nid = document.properties['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 Packages.org.apache.commons.httpclient.HttpClient();
var post = new Packages.org.apache.commons.httpclient.methods.PostMethod(url);

post.setRequestEntity(new Packages.org.apache.commons.httpclient.methods.StringRequestEntity(JSON.stringify(data), "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 {
    post.releaseConnection();
}&lt;/PRE&gt;&lt;P&gt;I tested this script in &lt;U&gt;&lt;STRONG&gt;Javascript Console&lt;/STRONG&gt;&lt;/U&gt; it &lt;U&gt;&lt;STRONG&gt;works good&lt;/STRONG&gt;&lt;/U&gt;, but when i try to execute it when adding a document, it shows the following error:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sans titre.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/1655i403D9C2B03A391C1/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;What might be the problem here? Am I using the wrong packages?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 16:08:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/post-alfresco-data-to-odoo-erp/m-p/145966#M38676</guid>
      <dc:creator>imanez1</dc:creator>
      <dc:date>2023-04-12T16:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: POST alfresco data to ODOO ERP</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/post-alfresco-data-to-odoo-erp/m-p/145967#M38677</link>
      <description>&lt;P&gt;Please check alfresco log. There you will get idea why it is failing.&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2023 04:10:15 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/post-alfresco-data-to-odoo-erp/m-p/145967#M38677</guid>
      <dc:creator>sp2</dc:creator>
      <dc:date>2023-05-01T04:10:15Z</dc:date>
    </item>
  </channel>
</rss>

