EmbedFetch API: Simplifying Social Media Content Retrieval
Discover how to use the EmbedFetch API to easily search, preview, and fetch embedded content from various social media platforms. This comprehensive guide covers API endpoints, request parameters, response structures, and best practices for seamless integration.
EmbedFetch API Documentation
Welcome to the EmbedFetch API documentation! This guide will help you understand how to use our API to fetch and preview embedded content from various social media platforms.
API Endpoints
Our API provides three main endpoints:
- Search
- Preview
- Combined (Search and Preview)
Let's dive into each of these endpoints and how to use them.
1. Search Endpoint
The search endpoint allows you to find content based on a URL.
Endpoint: /api/v1/providers/search
Method: GET
Parameters:
url
(required): The URL of the content you want to search for.provider
(optional): The specific provider to use (e.g., "tiktok", "instagram").
Example Request:
GET /api/v1/providers/search?url=https://www.tiktok.com/@username/video/1234567890
Response:
The search endpoint returns a JSON object containing a key
that you can use for subsequent preview requests.
2. Preview Endpoint
The preview endpoint allows you to fetch a preview of the content using the key obtained from the search endpoint.
Endpoint: /api/v1/providers/preview
Method: GET
Parameters:
search_key
(required): The key obtained from the search endpoint.
Example Request:
GET /api/v1/providers/preview?search_key=search_abcdefghijklmnop
Response: The preview endpoint returns detailed information about the content, including user data, media URLs, and statistics.
3. Combined Endpoint
The combined endpoint allows you to perform both search and preview operations in a single request.
Endpoint: /api/v1/providers/combined
Method: GET
Parameters:
q
(optional): The URL of the content you want to search for.search_key
(optional): The key obtained from a previous search.
You must provide either q
or search_key
.
Example Requests:
GET /api/v1/providers/combined?q=https://www.tiktok.com/@username/video/1234567890
or
GET /api/v1/providers/combined?search_key=search_abcdefghijklmnop
Response: The combined endpoint returns the same detailed information as the preview endpoint.
Response Structure
The API responses follow a consistent structure:
For successful requests, you'll receive a JsonResult
containing the requested data. In case of errors, you'll receive an ErrorResult
with an error message and status code.
Error Handling
The API uses standard HTTP status codes to indicate the success or failure of requests. Common error codes include:
- 400: Bad Request (e.g., missing required parameters)
- 404: Not Found (e.g., invalid search key or URL)
- 500: Internal Server Error
Always check the status code and error message in the response to handle errors appropriately in your application.
Rate Limiting and Authorization
Our API implements rate limiting to ensure fair usage. If you exceed the rate limit, you'll receive a preview version of the content instead of the full data. To increase your rate limit, contact our support team for a higher limit API key.
Best Practices
-
Always store the
search_key
returned by the search endpoint for future use. This allows you to quickly fetch previews without performing a new search. -
Use the combined endpoint when you're unsure if you have a valid
search_key
. It will automatically perform a search if needed. -
Handle errors gracefully in your application by checking the status code and error messages in the API responses.
-
If you're building a high-traffic application, implementing caching on your end to reduce the number of API calls.
Conclusion
The EmbedFetch API provides a powerful way to fetch and preview content from various social media platforms. By following this documentation and best practices, you'll be able to integrate our API seamlessly into your applications.
If you have any questions or need further assistance, please don't hesitate to contact our support team. Happy coding!
By embedez on