The official Java SDK for the OhSpotted LinkedIn change tracking API.
Follow public LinkedIn profiles, company pages and jobs, and read what changed on them as signals, checked once a day.
The SDK exposes 9 typed methods, one per documented endpoint, each with a parameter builder, plus a generic request(). It uses java.net.http.HttpClient and Jackson.
- Java 17 or newer
The SDK is not on Maven Central. Build it from source, which installs it in your local Maven repository:
git clone https://github.com/ohspotted/ohspotted-java.git
cd ohspotted-java
mvn -q install -DskipTestsThen add it to your project. Maven:
<dependency>
<groupId>com.ohspotted</groupId>
<artifactId>ohspotted</artifactId>
<version>0.3.0</version>
</dependency>Gradle, with mavenLocal() in your repositories:
implementation("com.ohspotted:ohspotted:0.3.0")Sign up for OhSpotted or sign in, then copy your API key from the dashboard. OhSpottedClient.fromEnv() reads the OHSPOTTED_API_KEY environment variable.
import com.ohspotted.ApiResponse;
import com.ohspotted.OhSpottedClient;
import com.ohspotted.params.AddTargetParams;
OhSpottedClient client = OhSpottedClient.fromEnv();
ApiResponse response = client.addTarget(AddTargetParams.builder().url("https://www.linkedin.com/company/linkedin").build());
System.out.println(response.json().toPrettyString());Parameter builders mirror the API reference; build() checks required parameters. Use response.as(MyType.class) to map the JSON onto your own types.
Each method uses the HTTP verb of its endpoint. GET and DELETE send parameters in the query string; POST and PATCH send them as a JSON body. Null values are never sent.
ApiResponse response = client.request("GET", "/usage", Map.of());try {
client.addTarget(AddTargetParams.builder().url("https://www.linkedin.com/company/linkedin").build());
} catch (OhSpottedApiException e) {
System.err.println(e.status() + ": " + e.getMessage());
}| Exception | When |
|---|---|
OhSpottedConfigurationException |
Missing API key, invalid options or unsupported method. |
OhSpottedSerializationException |
A required parameter is missing or a value can't be sent. |
OhSpottedTransportException |
Network failure, timeout or interruption. |
OhSpottedApiException |
Non-2xx status (status(), errorMessage(), errorCode() such as no_credits, responseBody(), rawResponse()). |
OhSpottedResponseDecodingException |
A success response could not be decoded. |
All of them extend the unchecked OhSpottedException.
Requests are retried up to 3 times after a network error, a 408, 500, 502, 503 or 504. Other statuses, such as 400, 401, 402, 404 or 429, and client-side timeouts are not retried: the API's rate limits last until the hour (or the day) is over, and on the free plan every retry would count as a request. The delay starts at 1 second and grows 1.5× per retry (capped at 30 seconds); a Retry-After header wins.
OhSpottedClient client = OhSpottedClient.builder().maxRetries(5).retryDelay(Duration.ofMillis(500)).build();
client.addTarget(AddTargetParams.builder().url("https://www.linkedin.com/company/linkedin").build(), RequestOptions.builder().maxRetries(0).build()); // one request without retriesbatch() runs a function per item on 10 threads (concurrency) and returns one BatchResult per item, in input order. A failing item never stops the others.
List<String> inputs = List.of("https://www.linkedin.com/company/linkedin", "https://www.linkedin.com/company/microsoft", "https://www.linkedin.com/company/github");
List<BatchResult<ApiResponse>> results = client.batch(inputs, 5, value ->
client.addTarget(AddTargetParams.builder().url(value).build()));
for (BatchResult<ApiResponse> result : results) {
if (result.ok()) {
System.out.println(result.value().json());
} else {
System.err.println(inputs.get(result.index()) + ": " + result.error().getMessage());
}
}| Constant | Default | Description |
|---|---|---|
OhSpottedClient.DEFAULT_CONCURRENCY |
10 |
Tasks run at the same time by batch |
OhSpottedClient.DEFAULT_TIMEOUT |
Duration.ofSeconds(120) |
Request timeout |
OhSpottedClient.MAX_RETRIES |
3 |
Retry attempts after a network error, a 408/5xx |
OhSpottedClient.RETRY_BACKOFF_FACTOR |
1.5 |
Exponential backoff multiplier |
OhSpottedClient.DEFAULT_RETRY_DELAY |
Duration.ofSeconds(1) |
Delay before the first retry |
OhSpottedClient client = OhSpottedClient.builder()
.apiKey(System.getenv("OHSPOTTED_API_KEY"))
.timeout(Duration.ofSeconds(60)) // default 120 s, null disables
.header("X-Trace", "abc")
.transport(OhSpottedTransport.fromHttpClient(myHttpClient)) // optional
.build();9 methods, generated from the OpenAPI document.
| Method | HTTP | Description |
|---|---|---|
addTarget() |
POST /targets |
Adds a LinkedIn profile, company page or job to the list. The first read happens shortly after, usually within minutes, and only takes the… |
getTarget() |
GET /targets/{id} |
One target, with its latest signal. |
getUsage() |
GET /usage |
The plan, the credits left, how many pages are followed and how many the plan allows, and the credits the active pages use in 30 days. Ever… |
listSignals() |
GET /signals |
The signals found on every page of the list since each was added, newest first: the same as The Tea in the app. |
listTargetSignals() |
GET /targets/{id}/signals |
The signals found on one page since the account added it, newest first. A signal is a change between two daily reads: nothing is found betw… |
listTargets() |
GET /targets |
The account's list, newest first, with each page's state and its latest signal. A target is a LinkedIn profile, company page or job followe… |
markSignalsSeen() |
POST /signals/seen |
Marks every signal found so far as seen, on every page of the list. No body is needed. For one page, send seen: true to PATCH /targets/{id}. |
removeTarget() |
DELETE /targets/{id} |
Takes the page off the list. Its signals are no longer shown to the account; nothing else changes for the people who follow it too. |
updateTarget() |
PATCH /targets/{id} |
Send paused, muted and/or seen. A paused page isn't read and costs nothing; a muted page is still read and its signals are kept, but it isn… |
| SDK | Package | Install |
|---|---|---|
| Node.js | @ohspotted/sdk |
npm install @ohspotted/sdk |
| Python | ohspotted |
pip install ohspotted |
| Go | ohspotted-go |
go get github.com/ohspotted/ohspotted-go |
| .NET | OhSpotted |
dotnet add package OhSpotted |
| Ruby | ohspotted |
gem install ohspotted |
| PHP | ohspotted/sdk |
composer require ohspotted/sdk |
| Java | ohspotted-java |
build from source, see its README |
| CLI | @ohspotted/cli |
npm install -g @ohspotted/cli |
| MCP server | @ohspotted/mcp |
npx -y @ohspotted/mcp |
LinkedIn® is a registered trademark of LinkedIn Corporation. OhSpotted is not affiliated with, endorsed or sponsored by LinkedIn.
MIT — see LICENSE.