Developer forum

Forum » Integration » BC endpoints syntax for filtering

BC endpoints syntax for filtering

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I am working on an integration with BC and I am trying to make use for the endpoints functionality.

The first question I have is related to using the endpoints in the template (or back-end code) logic.
For example, If I want to make a request to an endpoint and avoid redefining the authentication and URL of the endpoint, maybe I can access it directly by an ID or a Name. This would make things pretty easy to work with especially when having multiple environments.

The second question is filtering.

I understand that I can filter using a query string $filter and that is fine. I am wondering if I can do something like this:

get {{url}}/companies({{company}})/events('SOMEFILTERVALUE')/sponsors

or even something like this:

get {{url}}/companies({{company}})/events/sponsors(SOMEGUID)

Where SOMEFILTERVALUE and SOMEGUID would be dynamic values.

Thank you,

Adrian


Replies

 
Frederik Nielsen Dynamicweb Employee
Frederik Nielsen
Reply

Hi Adrian,

If I understand the first question correctly, what you could do is simply just use the EndpointService from Dynamicweb.DataIntegration.EndpointManagement to fetch an endpoint by its id and execute it through the EndpointService.

For the second question, I understand that you want to fill in some placeholders set in the endpoint. If that's the case, you can always modify the endpoints url or parameters and send the modified endpoint down to the Execute function, as it would retain the authentication setup etc.

I hope that helps,

Frederik

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Frederik,

Thank you very much for the answers. Very useful.

For the first point, it's clear. I will use this approach.

For the second part, I believe that your suggestion is very good when using the endpoints in code (first point).

In my mind, I was also thinking about using the endpoints in DataIntegration jobs. I assume in that case it's not possible to play around with the querystring.

Thank you,
Adrian

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Frederik,

I have followed your advice and tried to manipulate the Endpoint.FullUrl property but apparently it is read-only.

Do you know any other workaround for creating a new Endpoint with my new URL?

Thank you,
Adrian

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Frederik,

Nevermind my question. Apparently, I can overwrite the Url property.

Thank you,
Adrian

 

You must be logged in to post in the forum