The official Terra Java client library.
Add this dependency to your project's build file:
implementation "co.tryterra:terra-client:<version>"
Add this dependency to your project's POM:
<dependency>
<groupId>co.tryterra</groupId>
<artifactId>terra-client</artifactId>
<version>${terra-client.version}</version>
</dependency>
TerraExample.java
import co.tryterra.terraclient.TerraClientFactory;
import co.tryterra.terraclient.api.TerraApiResponse;
import co.tryterra.terraclient.api.TerraClientV2;
import co.tryterra.terraclient.api.User;
import co.tryterra.terraclient.exceptions.TerraRuntimeException;
import co.tryterra.terraclient.models.Athlete;
public class TerraExample {
public static void main(String[] args) {
TerraClientV2 client = TerraClientFactory.getClientV2("YOUR_API_KEY", "YOUR_DEV_ID");
try {
User user = client.getUser("YOUR_USER_ID");
TerraApiResponse<Athlete> response = client.getActivityForUser(user);
System.out.println(response.getParsedData());
} catch (TerraRuntimeException ex) {
ex.printStackTrace();
}
}
}