How to fetch the data from an API and display it on the screen on any component.
1 Like
To fetch the data from an API and display it on the component, You will have to apply API task for that.
vFlow-> Task group
- Add new Task group. Provide name.
- Add task -‘API’. Provide basic details into it.
- In configuration section : Write the name of ‘service’ in it(Make sure to write the exact same name as written in vConnect).
- In C2S: Have to provide the key name , Type and data path from where you have to fetch the data from the client(Specifically in this case, keep C2S blank).
- In S2C: Provide Key name, Type and Data path as per the API object.
For instance:
Key value: getVal("tempObject.dashboard.accounts")
Type- JSON
Data Path - getVal("ACCOUNTS_NUM.count")
- Submit the task.
To get the component refreshed whenever any changes made to data, You will have to add ‘INVOKE_ENTITY’.
- Add another task within the same task group.
- Provide basic details in that task.
- In configuration section : Add the required Queue component in the ‘component Id section’.
- Submit the task & Task group.
Create Event
- Add new ‘On Load’ event.
- Bind that task group into this event.
- Map this Event in the Dependents section of the page.
- Submit the page, Publish it and sync it with release manager.
Changes to be made on component level:
- Edit the properties section of an element of queue component and select the ‘Show Count’ option.
- Also can provide the default value as well.
For instance: The value is provided on the Queue component named USERS as 12.
1 Like
To fetch the data from an API and display it on the component, You will have to apply API task for that.
vFlow-> Task group
- Add new Task group. Provide name.
- Add task -‘API’. Provide basic details into it.
- In configuration section : Write the name of ‘service’ in it(Make sure to write the exact same name as written in vConnect).
- In C2S: Have to provide the key name , Type and data path from where you have to fetch the data from the client(Specifically in this case, keep C2S blank).
- In S2C: Provide Key name, Type and Data path as per the API object.
For instance:
Key value: getVal("tempObject.dashboard.accounts")
Type- JSON
Data Path - getVal("ACCOUNTS_NUM.count")
- Submit the task.
To get the component refreshed whenever any changes made to data, You will have to add ‘INVOKE_ENTITY’.
- Add another task within the same task group.
- Provide basic details in that task.
- In configuration section : Add the required Queue component in the ‘component Id section’.
- Submit the task & Task group.
Create Event
- Add new ‘On Load’ event.
- Bind that task group into this event.
- Map this Event in the Dependents section of the page.
- Submit the page, Publish it and sync it with release manager.
Changes to be made on component level:
- Edit the properties section of an element of queue component and select the ‘Show Count’ option.
- Also can provide the default value as well.
For instance: The value is provided on the Queue component named USERS as 12.
2 Likes