Managing OpenGraph Metadata for Links
The OpenGraph API endpoint allows you to manage OpenGraph metadata for branded short links. You can retrieve, create, or delete OpenGraph metadata associated with a link. OpenGraph metadata enhances how links appear on social media platforms and includes fields like title, description, image, type, and locale.
Endpoint Overview
Base URL:
https://api.rebrandly.com/v1/links/{id}/opengraph
Operations
Get OpenGraph Metadata
Retrieve the OpenGraph metadata of a specific branded short link.
HTTP Method: GET
Authorization: Requires an API key and appropriate permissions.
$ curl 'https://api.rebrandly.com/v1/links/FFfa4cc5b6ee45d6g7897b06ac2d16af/opengraph' \
-H 'apikey: YOUR_API_KEY'
Example Response
{
"title": "What is Rebrandly",
"description": "Learn about branded short links.",
"image": "https://rebrandly.com/example.jpg",
"type": "website",
"locale": "en_US"
}
Create or Update OpenGraph Metadata
Add or update OpenGraph metadata for a link.
HTTP Method: POST
Authorization: Requires owner or admin role. The feature must be enabled for the workspace.
Request Body:
title(string): The OpenGraph title. (Required)description(string): A brief description. (Optional)image(string): URL of the OpenGraph image. (Optional)type(string): The OpenGraph object type. (Optional)locale(string): The language/locale code. (Optional)
Validation Rules:
titlemust be a non-empty string.description,image,type, andlocalemust be strings if provided.
$ curl -X POST 'https://api.rebrandly.com/v1/links/FFfa4cc5b6ee45d6g7897b06ac2d16af/opengraph' \
-H 'apikey: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"title": "What is Rebrandly",
"description": "Learn about branded short links.",
"image": "https://rebrandly.com/example.jpg",
"type": "website",
"locale": "en_US"
}'
Example Response
{
"title": "What is Rebrandly",
"description": "Learn about branded short links.",
"image": "https://rebrandly.com/example.jpg",
"type": "website",
"locale": "en_US"
}
Delete OpenGraph Metadata
Remove OpenGraph metadata from a specific link.
HTTP Method: DELETE
Authorization: Requires owner or admin role.
$ curl -X DELETE 'https://api.rebrandly.com/v1/links/FFfa4cc5b6ee45d6g7897b06ac2d16af/opengraph' \
-H 'apikey: YOUR_API_KEY'
Example Response
{}
PATH PARAMETERS
| Path parameter | Description |
|---|---|
| id | The unique identifier of the branded short link whose OpenGraph data is being managed. |
Handling errors
| HTTP Status | Error type | Description |
|---|---|---|
| 401 | Una | API key missing or user lacks permissions. |
| 404 | Not found | Given id does not correspond to any existing link |
| 403 | Validation error | One or more fields in the request body are invalid. |
Updated 11 months ago
