Setting the Endpoint

A REST endpoint is the first part of the URI and it specifies the location at which the various resources of the API can be found.

When instantiating a JadeRestClient object, you need to provide the endpoint of the API as a parameter to the create method. For example, consider the following URI from the Swagger Petstore example REST API.

The https://petstore.swagger.io/v2/ part is the endpoint, which is where the API is found, and it contains multiple resources. The /pet/3 part is the specific resource we are accessing. Together they make up the URI; however it is the endpoint part we need to provide in the create method of the JadeRestClient object, as follows.

client := create JadeRestClient("https://petstore.swagger.io/v2/");

If you want to change the endpoint of an existing JadeRestClient object, you can use the setEndpoint method of the JadeRestClient class to do so, as follows.

client.setEndpoint("https://petstore.swagger.io/v2/");