12-21-2018 07:28 AM
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
12-21-2018 10:51 AM
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())
}
12-21-2018 10:51 AM
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())
}
12-24-2018 12:16 AM
Hi Eugenio Romano,
Thanks for reply.
What is the difference between "alfrescoJsApi.core.webscriptApi" and "apiService.getInstance().webScript"?
Thanks
Vidhi
12-28-2018 10:04 AM
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
02-01-2022 02:17 AM
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'.
02-15-2022 09:51 AM
08-31-2023 01:42 PM
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?
09-08-2023 10:01 AM
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
Explore our Alfresco products with the links below. Use labels to filter content by product module.