Ensuring Items are Up-to-Date
We commonly get one of the following questions from customers during onboarding:
- "How do we backfill all our historical data into Cove?"
- "What if we don't want to send all of our Items to Cove, and then a moderator wants to see an Item in the Moderator Console that we haven't sent to Cove yet?"
- "How can you ensure that the Item you're rending in the Moderator Console is fully up-to-date and reflects the current state of the Item?"
Both of these problems can be solved with a simple solution that we call the Partial Items API. You'll have to build an API endpoint that can receive POST requests from Cove. Here's how the data flow should work:
- Cove needs to get some information about a particular Item, so we'll send a POST request to your Partial Items API endpoint with your unique ID for that Item.
- You'll fetch information about that Item and return it to Cove in the response. Even if you can't fetch all of the attributes of the Item (perhaps because of some limitations in your data model or query latency), you can just return as many attributes as you have access to. In other words, you can return a partial version of the Item, even if some attributes are missing.
Once you create this endpoint, you'll need to provide Cove with the endpoint's URL and any required headers so that we can make these HTTP requests. For now, there is nowhere in Cove's UI that allows you to set these values, so you'll have to send them to [email protected].
REST API Example
Here's an example of a POST request that Cove would send to this endpoint:
curl --request POST \
--url https://your-website-url.com/partial-items \
--header 'Content-Type: application/json' \
--data '{
"items": [
{
"id": "abc123",
"typeId": "def456"
},
{
"id": "xyz789",
"typeId": "def456"
}
]
}'
In the body of the request, there is only one top-level property called items
, which is an array of objects representing the Items about which Cove needs more information. This property is an array so that Cove can request batches of multiple Items within a single API request, when needed.
In each object in the items
array, we expect the following fields:
Property | Type | Description |
---|---|---|
id | String | Your unique identifier for this Item. |
typeId | String | The ID of the Item Type that corresponds to the Item. This will exactly match the ID of one of the Item Types that you defined in the Item Types Dashboard. The IDs of each Item Type can be found in that dashboard. |
Example Response
Cove expects a response in the following format:
{
items: [
{
id: "abc123", // the `id` we provided in the request body
typeId: "def456", // the `typeId` we provided in the request body
data: { // the same `data` JSON object you'd provide if you had sent this Item via the Item API (https://docs.getcove.com/docs/sending-content-to-protego)
text: "some text uploaded by a user"
// ... all other fields in your Item Type
},
},
... // other items
]
}
Updated 6 days ago