Java client library to execute operations on URLs using the Bitly V4 API.
The following Bitly APIs are currently supported:
- Shorten a Bitlink (
POST /v4/shorten
) - Expand a Bitlink (
POST /v4/expand
) - Retrieve a Bitlink (
GET /v4/bitlink/{bitlink}
) - Create a Bitlink (
POST /v4/bitlinks
) - Update a Bitlink (
PATCH /v4/bitlink/{bitlink}
) - Get Clicks for a Bitlink (
GET /v4/bitlink/{bitlink}/clicks
) - Get Clicks Summary for a Bitlink (
GET /v4/bitlink/{bitlink}/clicks/summary
) - Get Metrics for a Bitlink by Countries (
GET /v4/bitlinks/{bitlink}/countries
) - Get Metrics for a Bitlink by Referrers (
GET /v4/bitlinks/{bitlink}/referrers
) - Get Metrics for a Bitlink by Referring Domains (
GET /v4/bitlinks/{bitlink}/referring_domains
) - Get Metrics for a Bitlink by Referrers by Domain (
GET /v4/bitlinks/{bitlink}/referrers_by_domains
) - PREMIUM Get a QR Code for a Bitlink (
GET /v4/{bitlink}/qr
)
- Create Custom Bitlink (
POST /v4/custom_bitlinks
) - PREMIUM Retrieve Custom Bitlink (
GET /v4/custom_bitlinks/{custom_bitlink}
) - PREMIUM Update Custom Bitlink (
PATCH /v4/custom_bitlink/{custom_bitlink}
) - PREMIUM Get Metrics for a Custom Bitlink by Destination (
GET /v4/custom_bitlinks/{custom_bitlink}/clicks_by_destination
)
- Retrieve Group (
GET /v4/groups/{group_guid}
) - Update Group (
PATCH /v4/groups/{group_guid}
) - Retrieve Groups (
GET /v4/groups
) - Delete Group (
DELETE /v4/groups/{group_guid}
) - Retrieve Tags by Group (
GET /v4/groups/{group_guid}/tags
) - Retrieve Group Shorten Counts (
GET /v4/groups/{group_guid}/shorten_counts
) - Retrieve Group Preferences (
GET /v4/groups/{group_guid}/preferences
) - Update Group Preferences (
PATCH /v4/groups/{group_guid}/preferences
) - Retrieve Bitlinks by Group (
GET /v4/groups/{group_guid}/bitlinks
) - Retrieve Sorted Bitlinks by Group (
GET /v4/groups/{group_guid}/bitlinks/{sort}
) - Get Click Metrics for a Group by Countries (
GET /v4/groups/{group_guid}/countries
) - Get Click Metrics for a Group by Referring Networks (
GET /v4/groups/{group_guid}/referring_networks
)
- Retrieve Organizations (
GET /v4/organizations
) - Retrieve Organization (
GET /v4/organizations/{organization_guid}
) - Retrieve Organization Shorten Counts (
GET /v4/organizations/{organization_guid}/shorten_counts
)
- PREMIUM Retrieve Campaign (
GET /v4/campaigns/{campaign_guid}
) - PREMIUM Create Campaign (
POST /v4/campaigns
) - PREMIUM Update Campaign (
PATCH /v4/campaigns/{campaign_guid}
) - PREMIUM Retrieve Campaigns (
GET /v4/campaigns
)
- PREMIUM Retrieve Channel (
GET /v4/channels/{channel_guid}
) - PREMIUM Create Channel (
POST /v4/channels
) - PREMIUM Update Channel (
PATCH /v4/channels/{channel_guid}
) - PREMIUM Retrieve Channels (
GET /v4/channels
)
- PREMIUM Retrieve a Webhook (
GET /v4/webhooks/{webhook_guid}
) - PREMIUM Create a Webhook (
POST /v4/webhooks
) - PREMIUM Update a Webhook (
PATCH /v4/webhooks/{webhook_guid}
) - PREMIUM Fetch all Webhooks for an Organization (
GET /v4/organizations/{organization_guid}/webhooks
) - PREMIUM Delete a Webhook (
DELETE /v4/webhooks/{webhook_guid}
)
A detailed set of examples of the usage of each of the APIs can be found on the API site.
A Bitly account with an access token. The user needs to generate an Access Token to provide access via the Bitly V4 API. The Access Token is referenced in the documentation as the parameter "YOUR_ACCESS_TOKEN".
First clone the repository using:
>$ git clone https://github.com/opsmatters/bitly-java-api.git
>$ cd bitly-java-api
To compile the source code, run all tests, and generate all artefacts (including sources, javadoc, etc):
mvn package -Dbitly.access_token="<YOUR_ACCESS_TOKEN>"
To execute the unit tests:
mvn clean test -Dbitly.access_token="<YOUR_ACCESS_TOKEN>"
The following tests are included:
- testBitlinksServices: Operations on bitlinks such as shorten and expand.
The build artefacts are hosted in The Maven Central Repository.
Add the following dependency to include the artefact within your project:
<dependency>
<groupId>com.opsmatters</groupId>
<artifactId>bitly-java-api</artifactId>
<version>1.0.2</version>
</dependency>
- HttpComponents - RESTful Web Services in Java using HttpClient and HttpCore
- Gson - Java serialization/deserialization library
- Guava - An open-source set of common libraries for Java
- Maven - Dependency Management
- JUnit - Unit testing framework
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
This project use SemVer for versioning. For the versions available, see the tags on this repository.
- Gerald Curley - Initial work - opsmatters
See also the list of contributors who participated in this project.
This project is licensed under the terms of the Apache license 2.0.
Copyright (c) 2020 OpsMatters