Visual Builder Cloud Service makes it very easy to add REST services to your application – through the "new service connection" wizard you specify the URL to any REST service and a new entry is created for you. However, here is a small tip that will make your application management and performance better when you are leveraging multiple services from the same source – gather them into a single service.
A service connection in VBCS can have multiple end-point defined in it. If you just run through the wizard for adding a service – each end point will create a new service definition. The best practice is to add new endpoint definition into the same service definition when possible.
Let's work through an example:
We'll use a set of services about countries available here:
https://restcountries.eu/#api-endpoints-code
You'll see for example these services there:
- https://restcountries.eu/rest/v2/name/{name}?fullText=true
- https://restcountries.eu/rest/v2/alpha/{code}
The right way to add both to your project is:
1. Use the "Create Service" wizard to add the first end point:
Going through the wizard will end up with a place for you to define the specific end point:
And once you finish this section of the wizard your service will have one end point defined:
Notice that in this page there is a big blue button "+Endpoint" – and you should click that one to add the next service/endpoint:
Which will bring you into a similar flow for defining the second end point:
That's it quite simple – now you have a single service definition with multiple end-points.
One of the advantages of this approach is that if your source server changes an address – you just have one point to update, and this will take care of all the end points.
Another advantage is runtime performances – VBCS doesn't need to upload and parse multiple service defintions – rather it does it only once, and leverages the information for all the end points.
