NodesApi

cancel
Showing results for 
Search instead for 
Did you mean: 
robertwoodhead
Member II

NodesApi

Has anyone be successfull at implementing the NodesApi ? https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/NodesApi.md#u...

Have tried NodesApiService (createNode doesn't work).  https://www.alfresco.com/abn/adf/docs/core/services/nodes-api.service/

Have tried AlfrescoApiService (nodesApi.updateNode works). https://www.alfresco.com/abn/adf/docs/core/services/alfresco-api.service/

How can I implement NodesApi javascript/typescipt so all available methods work?

2 Replies
mauriziovitale
Alfresco Employee

Re: NodesApi

Hi @robertwoodhead have you tried to follow the example?

import NodesApi from 'NodesApi';
import { AlfrescoApi } from '@alfresco/js-api';

this.alfrescoApi = new AlfrescoApi();
this.alfrescoApi.setConfig({
    hostEcm: 'http://127.0.0.1:8080'
});

let nodesApi = new NodesApi(this.alfrescoApi);
nodesApi.createNode('-root-', { { "name": "My new subfolder" }, nodeType: 'cm:folder' }).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});
Prachi_Shah
Active Member

Re: NodesApi

Hii,

Please check once version of '@alfresco/js-api' in package.json file, it should be latest version like 3.9.0. to use all updated services and its methods. Then run npm i command and you will get all avilable methods using NodesApi Service.

Regards,
Prachi Shah| ContCentric