We have a working connection and request in DW Integration module that works with a custom Odata4 endpoint in BC (see image). The use case here is to create a selector function in the UX where the user can select one of the addresses in the BC response. What architecture would you recommend to achieve that? For example a service page in DW that utilizes the integration > connection > request? But can dynamically set filter per customer number in that parameter? Then the service page supply a UX JS function with the BC response as JSON data.
Developer forum
E-mail notifications
BC custom integration with Odata4 endpoint
Replies
Hi Joakim,
Good question :)
First of all, if you want to show a list of addresses to a user in the frontend, I would consider synchronizing the data to the AccessUserAddress table, which both the User Mangement and Cart apps can display in the frontent, and these would also be accessible through the wb api. Given the port number, it looks like you're running an on-prem environment, and when that is down for maintenance, the list of addresses would be inaccessible. The reason why I mention this is, that we experience more and longer maintenance windows on on-prem environments that cloud hosted ones, and if it's crucial that this information should always be available, you might consider synchronizing it.
For your question, and the scenario you're describing, i definately use the service approach that you suggest yourself, so you keep actual endpoint and authentication protected in DW.
You can use the endpoint API in the following way:
//Set some variables
var endpointId = 1
var billToCustomerNumber = 'some number'
//Instantiate the endpoint you want to connect to:
var endpointService = new Dynamicweb.DataIntegration.EndpointManagement.EndpointService();
var endpoint = endpointService.GetEndpointById(endpointId);
//If you override the values in the endpoint, they will be cached, so instantiate a new endpoint an add the values from the existing one, e.g. if you manipulate with the URL
var ep = new Dynamicweb.DataIntegration.EndpointManagement.Endpoint();
ep.Url = $"{endpoint.Url}?$filter=BillToCustomerName eq '{billToCustomerNumber}';
ep.AuthenticationId = endpoint.AuthenticationId;
//Finally, send the request and receive the json response:
jsonResponse = endpointService.Execute(ep);
Then, how you relay the json back to the UX is up to you. You can relay it either as is, or searialize it into another format known to your UX framework.
Hope this helps, otherwise, feel free to get back :)
Br.
Lars
You must be logged in to post in the forum