Hey,
I don't understand how to use scriptArgs in [AlfrescoApiService].getInstance().webScript.executeWebScript in ADF.
I tried several ways, even using a regular string, but none of them worked.
I solved it for now by adding the args to tthe scriptPath and it works, but I wondered if someone could explain how the scriptArgs work.
this.apiService.getInstance().webScript.executeWebScript(
'GET',
`api/vmm/agendastructuur/workspace/SpacesStore/${result.id}?showAgendapunten=false`,
null,
null,
null,
null
).then(
(response: any) => {
const convertedResponse = this.objectToObjectArray(response);
// console.log(convertedResponse);
this.nodes = convertedResponse;
}
);
Thanks!
David.
Solved! Go to Solution.
Inside the project, there is an index.d.ts that should help your IDE to understand the types. Maybe your IDE is not configured in the riight way. Anyway, this the types: :
executeWebScript(httpMethod?: string, scriptPath?: string, scriptArgs?: any, contextRoot?: string, servicePat?: string, postBody?: string): Promise<{}>; |
It will compose an URL like that:
http(s)://(host)port)/(contextPath)/(servicePath)/(scriptPath)?(scriptArgs)
scriptArgs is an object like that:
vat myParams = {
myUrlVar: 'value1',
myUrlVarTwo: 'value2',
};
So for example, if you use it:
this.alfrescoJsApi.core.webscriptApi.executeWebScript('GET', 'mytasks', myParams, 'share', 'differentServiceSlug');
It should invoke
http://127.0.01:8080/share/differentServiceSlug/mytasks?myUrlVar=value1&myUrlVarTwo=value2
Hi David maybe the official JS-API documentation can help you:
Hi Eugenio,
Thanks for answering.
The first thing that I have done was looking into the official documentation, I know where I should put the different parameters, but the exact format isn't defined there.
I already tried a flat string (in the example above it would be: "showAgendapunten=false") as third parameter, but I didn't get the desired results. I also tried an object, object Array, string Array as third parameter, it all didn't work.
David.
Inside the project, there is an index.d.ts that should help your IDE to understand the types. Maybe your IDE is not configured in the riight way. Anyway, this the types: :
executeWebScript(httpMethod?: string, scriptPath?: string, scriptArgs?: any, contextRoot?: string, servicePat?: string, postBody?: string): Promise<{}>; |
It will compose an URL like that:
http(s)://(host)port)/(contextPath)/(servicePath)/(scriptPath)?(scriptArgs)
scriptArgs is an object like that:
vat myParams = {
myUrlVar: 'value1',
myUrlVarTwo: 'value2',
};
So for example, if you use it:
this.alfrescoJsApi.core.webscriptApi.executeWebScript('GET', 'mytasks', myParams, 'share', 'differentServiceSlug');
It should invoke
http://127.0.01:8080/share/differentServiceSlug/mytasks?myUrlVar=value1&myUrlVarTwo=value2
Thank you, this works.
My IDE (IntelliJ IDEA) is configured the right way to show hints, but I couldn't make out what the 'any' type stands for.
yep maybe we have to improve that type definition, good point thanks
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.