Previous ‹cURL

Java

This section shows how to use the API with different use cases examples.
Here you can download the API, see the examples of use cases and view the documentation:

Dependencies

You can find the source code with examples of use cases in Hrider-API-UseCases.zip . The project uses Eclipse Jersey as REST Client. Besides the dependencies included in the Maven file pom.xml include locally the Hrider-API.jar library. The pom.xml file includes:

<dependencies>
    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-client</artifactId>
        <version>2.30.1</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.inject</groupId>
        <artifactId>jersey-hk2</artifactId>
        <version>2.26</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.13</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-json-jackson</artifactId>
        <version>2.30</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-multipart</artifactId>
        <version>2.31</version>
    </dependency>
</dependencies>    
                    

The token and the connection URL are configured in the file src/main/resources/config.properties. For more information, see how to get an API key . Replace yourAuthApiKey with the obtained key:

api.token=bearer yourAuthApiKey
api.uri=https://dev.hrider.net/api
                    

Now we are ready to get the main anchor point. Use the classes ApiClient and HRiderService that includes all the necessary code to create the Jersey client. The basic code for version "v1" would be:

ApiClient client = new ApiClient();
HRiderService service = new HRiderService(client);
Root root = service.get(Root.class, new Link("v1"));
                        
Previous ‹cURL