Can I hard Code endpoints in my request code?
Can I hard Code endpoints in my request code?
If you are using streaming data, then you will have to use service discovery, since the list of endpoints in the response, depend on capability assigned to your ID.
For REST data requests, RDP is designed as an evolving platform, and the URL structure along with method signatures can change over a period of time. More specifically, a version number has been included in the URL. Upon a version change, older API endpoint will keep on providing data for some time. Its best, to keep the endpoint URL's in the configuration part of your codebase. See the python samples provided on the forum.
Suppose you intend to query data from the RDP REST API service and maintain the endpoint URL in your own app. You can also use RDP Library for Python and use Endpoint class to retrieve data like the following sample snippet of codes to retrieve JSON response messages from the top-news endpoint. You can create your own configuration to keep the endpoint like the suggestion from Gurpreet.
import refinitiv.dataplatform as rdp session=rdp.open_platform_session(....) endpoint = rdp.Endpoint(session,url='https://api.refinitiv.com/data/news/v1/top-news') resp=endpoint.send_request() if resp.data.raw is not None: print(resp.data.raw['data'])
Hello @marcwarren.bajo
Please note that you can get the API endpoint information from the API Playground page.