Hey @SaurabhCh ,
Collection Reactor API, you need to modify your API request to filter the libraries based on their publishing dates. The basic API endpoint you're using (https://reactor.adobe.io/properties/{PROPERTY_ID}/libraries) fetches the libraries associated with a specific property, but without additional filtering, it returns the current set of libraries.
Steps to Extract Libraries Published in 2023:
API Documentation:
- First, review the Adobe Data Collection (Reactor API) documentation to understand the available query parameters and how to filter the results by date.
Filtering by Date:
- The API might offer a way to filter libraries based on their 'published' date. This could involve adding query parameters to your API call.
Pagination Handling:
- If there are many libraries, the API might paginate the results. Ensure that your code can handle pagination to retrieve all relevant libraries.
API Request Example:
A modified API request might look something like this (note that this is a hypothetical example as the exact parameter names and formats depend on the API's specification):
This assumes that published_after and published_before are valid query parameters for filtering by date, which you need to verify in the documentation.
Scripting the Extraction:
- Use a scripting language like Python or JavaScript to make the API call and handle the JSON response.
- Loop through the paginated results (if applicable) and filter the libraries based on the publishing date.
Error Handling and Validation:
- Include error handling in your script to manage any API request failures.
- Validate the results to ensure that the data is accurate and complete.
Sample Code Snippet:
Here's a basic JavaScript example using fetch to illustrate how you might structure the request. Note that this is a generic template:
const PROPERTY_ID = 'your-property-id'; // Replace with your Property ID
const url = `https://reactor.adobe.io/properties/${PROPERTY_ID}/libraries?published_after=2023-01-01&published_before=2024-01-01`;
fetch(url, {
headers: {
'Authorization': 'Bearer your-access-token', // Replace with your access token
'Content-Type': 'application/vnd.api+json'
}
})
.then(response => response.json())
.then(data => {
console.log('Libraries Published in 2023:', data);
})
.catch(error => {
console.error('Error fetching libraries:', error);
});
Note:
- Authentication: Ensure that your API call includes proper authentication (usually a Bearer token).
- API Version: Check for the latest version of the API and any recent changes that might affect how the API call is structured.
Finally, if you're unable to find the required filtering capability in the existing API, consider retrieving all libraries and then filtering them based on the publishing date within your script. This approach, however, might be less efficient, especially if there are a large number of libraries.
Regards,
Eugene