{"id":23318126,"url":"https://github.com/cumulocity-iot/cumulocity-clients-java-v2","last_synced_at":"2025-08-22T17:30:50.741Z","repository":{"id":64551130,"uuid":"575789098","full_name":"Cumulocity-IoT/cumulocity-clients-java-v2","owner":"Cumulocity-IoT","description":"A Java gradle/maven project to work with Cumulocity IoT, generated using the Cumulocity IoT OpenAPI specification.","archived":false,"fork":false,"pushed_at":"2025-07-21T07:44:56.000Z","size":619,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-21T09:27:59.671Z","etag":null,"topics":["cumulocity-iot","iot-analytics","java"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cumulocity-IoT.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-12-08T09:52:53.000Z","updated_at":"2024-10-16T09:22:59.000Z","dependencies_parsed_at":"2024-04-16T09:36:54.972Z","dependency_job_id":"e66ccaef-b89f-4d96-b900-48bd82f4c946","html_url":"https://github.com/Cumulocity-IoT/cumulocity-clients-java-v2","commit_stats":null,"previous_names":["cumulocity-iot/cumulocity-clients-java-v2","softwareag/cumulocity-clients-java-v2"],"tags_count":0,"template":false,"template_full_name":"Cumulocity-IoT/cumulocity-iot-template","purl":"pkg:github/Cumulocity-IoT/cumulocity-clients-java-v2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cumulocity-IoT%2Fcumulocity-clients-java-v2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cumulocity-IoT%2Fcumulocity-clients-java-v2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cumulocity-IoT%2Fcumulocity-clients-java-v2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cumulocity-IoT%2Fcumulocity-clients-java-v2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cumulocity-IoT","download_url":"https://codeload.github.com/Cumulocity-IoT/cumulocity-clients-java-v2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cumulocity-IoT%2Fcumulocity-clients-java-v2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271673550,"owners_count":24800711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cumulocity-iot","iot-analytics","java"],"created_at":"2024-12-20T17:15:35.747Z","updated_at":"2025-08-22T17:30:50.734Z","avatar_url":"https://github.com/Cumulocity-IoT.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CumulocityCoreLibrary\n\n## Usage\n\nWhen using APIs, a new `WebTarget` needs to be created and passed using the constructor of each API class. Therefore, create a new `Client` and pass the resource target:\n\n```Java\nimport jakarta.ws.rs.client.Client;\nimport jakarta.ws.rs.client.ClientBuilder;\nimport jakarta.ws.rs.client.WebTarget;\n\nfinal Client client = ClientBuilder.newClient();\nfinal WebTarget webTarget = client.target(\"endpoint\");\nfinal SystemOptionsApi service = new SystemOptionsApi(webTarget);\n```\n\nThe resource implementation returns an instance of `java.util.concurrent.CompletionStage\u003cT\u003e` to allow developers to process a response using reactive concepts. Convert the `CompletionStage` into a completeable `Future` using `#toCompletableFuture()` and invoke either `#get()` or `#join()` on the `Future`. Both methods will wait until a response is received.  \n\n### Use your own domain model\n\nThe CumulocityCoreLibrary allows custom data models. The following classes are designed to be extensible:\n\n- `Alarm`, `AuditRecord`, `CategoryOptions`, `CustomProperties`, `Event`, `ManagedObject`, `Measurement`, `Operation`\n\nThose classes allow to add an arbitrary number of additional properties as a list of key-value pairs. These properties are known as custom fragments and can be of any type. Each custom fragment is identified by a unique name. Thus, developers can propagate their custom fragments using:\n\n```Java\nAlarm.Serialization.registerAdditionalProperty(String, Class\u003c?\u003e);\n```\n\nEach of the extensible objects contains a dictionary object holding instances of custom fragments. Use the custom fragment's key to access it's value.\n\n### Working with errors\n\nHTTP error codes will be forwarded and can be accessed using a `jakarta.ws.rs.core.Response`. Error codes can be retrievied by calling `#getStatus()`, respectively `#getStatusInfo`. The response object also allows access to error objects by calling `#readEntity(Class\u003c?\u003e)`. See the JavaDoc comment on each resource method to know what error types are returned.\n\nThe response object is only accessible when the underlying resource did not complete successfully. In this case, a `jakarta.ws.rs.WebApplicationException` is thrown. \n\nThe `java.util.concurrent` API enables different solutions to handle this exception. Common use cases are `CompletionStage#exceptionally(Function\u003cThrowable, ? extends U\u003e)` and `CompletionStage#handle(BiFunction\u003c? super U, Throwable, ? extends Object\u003e)` as shown in the following listing.\n\n```java\nfinal CompletionStage\u003cT\u003e stage = ...;\nstage.exceptionally(exception -\u003e {\n    if (exception.getCause() instanceof WebApplicationException) {\n    \tfinal Response response = ((WebApplicationException) exception.getCause()).getResponse();\n        response.readEntity(Error.class);\n    }\n    return null;\n});\n\nstage.handle((result, exception) -\u003e {\n    // exception might be null if the resource completes successfully\n    return null;\n});\n```\n\n### Basic Authentication\n\nThe client sends HTTP requests with the `Authorization` header that contains the word `Basic` word followed by a space and a base64-encoded string `username:password`.\nUsing Jersey, the `Authorization` header is added using a `HttpAuthenticationFeature`. \n\n```Java\nimport org.glassfish.jersey.client.ClientConfig;\nimport org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;\n\nimport jakarta.ws.rs.client.Client;\nimport jakarta.ws.rs.client.ClientBuilder;\nimport jakarta.ws.rs.client.WebTarget;\n\nfinal ClientConfig clientConfig = new ClientConfig();\nfinal HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic(\"userName\", \"password\");\nclientConfig.register(feature);\n```\n\nThe `HttpAuthenticationFeature` will be used to create a new `Client` and afterwards the `Authorization` header is automatically added to each request.\n\n```Java\nfinal Client client = ClientBuilder.newClient(clientConfig);\n```\n\n## Contribution\n\nIf you've spotted something that doesn't work as you'd expect, or if you have a new feature you'd like to add, we're happy to accept contributions and bug reports.\n\nFor bug reports, please raise an issue directly in this repository by selecting the `issues` tab and then clicking the `new issue` button. Please ensure that your bug report is as detailed as possible and allows us to reproduce your issue easily.\n\nIn the case of new contributions, please create a new branch from the latest version of `main`. When your feature is complete and ready to evaluate, raise a new pull request.\n\n---\n\nThese tools are provided as-is and without warranty or support. They do not constitute part of the Software AG product suite. Users are free to use, fork and modify them, subject to the license agreement. While Software AG welcomes contributions, we cannot guarantee to include every contribution in the master project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcumulocity-iot%2Fcumulocity-clients-java-v2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcumulocity-iot%2Fcumulocity-clients-java-v2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcumulocity-iot%2Fcumulocity-clients-java-v2/lists"}