Hello
I have configure my adf with alfresco by giving Ip address like xxx.xxx.x.x:8080 and i am also able to login.
Now I am trying to call custom webscript from adf using below api
import * as AlfrescoApi from 'alfresco-js-api';alfrescoJsApi: any;constructor(private apiService: AlfrescoApiService) {this.alfrescoJsApi = new AlfrescoApi({ provider: 'ALL' });this.alfrescoJsApi.core.webscriptApi.executeWebScript('GET', 'api/task-instances?authority=' + this.authService.getEcmUsername())}
but api is call localhost url like this
http://127.0.0.1:8080/alfresco/service/api/task-instances?authority=admin
insted of my configured ip.
How can i solve this?
Thanks
Vidhi
Solved! Go to Solution.
Hi the problem in your code is that you are instantiating a new alfrescoApi when you do :
this.alfrescoJsApi = new AlfrescoApi({ provider: 'ALL' });
and this API new object is missing of configuration of the ecmHost that you should pass in the constructor.
In your case, you are already anyway injecting the ADF AlfrescoApiService in the constructor when you do
constructor(private apiService: AlfrescoApiService) {
....
}
constructor(private apiService: AlfrescoApiService) {
this.apiService.getInstance().webScripti.executeWebScript('GET', 'api/task-instances?authority=' + this.authService.getEcmUsername())
}
Hi the problem in your code is that you are instantiating a new alfrescoApi when you do :
this.alfrescoJsApi = new AlfrescoApi({ provider: 'ALL' });
and this API new object is missing of configuration of the ecmHost that you should pass in the constructor.
In your case, you are already anyway injecting the ADF AlfrescoApiService in the constructor when you do
constructor(private apiService: AlfrescoApiService) {
....
}
constructor(private apiService: AlfrescoApiService) {
this.apiService.getInstance().webScripti.executeWebScript('GET', 'api/task-instances?authority=' + this.authService.getEcmUsername())
}
Hi Eugenio Romano,
Thanks for reply.
What is the difference between "alfrescoJsApi.core.webscriptApi" and "apiService.getInstance().webScript"?
Thanks
Vidhi
The first is a new instance that you are going to declare that is nor initialized by ADF and you need to configure it and handle the lifecycle.
The second is an instance created by ADF when bootstrap the core. It gets the configuration from the app.config.json of the framework and you can consume it without care about the lifecycle of it
I tried
constructor(private apiService: AlfrescoApiService) { this.apiService.getInstance().webScripti.executeWebScript('GET', 'api/task-instances?authority=' + this.authService.getEcmUsername()) }
The terminal said:
error TS2339: Property 'webScript' does not exist on type 'AlfrescoApi'.
How can I make an alfresco request from ADF to a custom alfresco api, I tried this link but it's deprecated, can anyone help me?
Hi,
do you get an answer to this ?
I have the same problem wirth adw wher we try to add a button with a call to a web script and nothing seems to work anymore.
We have no way to call the custom webscript we made on previous versions of Alfresco which were integrated in share !
Please, we need help.
Thanks
Best
Regis
Discussions, help and advice about the Alfresco Development Framework.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.