A content owner can can manage access to an entity they have shared. Access management is only available for items shared using the "Share to certain people only" method. Access management API is fairly straightforward, as simple as 2 methods: one of them grants access to an entity, and the other one revokes access. Granting access makes the content item immediately available for a given customer, with no confirmation required from their end. Revoking access immediately removes the content item from a given subscriber. Neither author nor subscrinbers will receive any related emails when using this API.
How to use the API
This API is available via HTTP POST to https://charts.trendspider.com/shared_entities/public/1/access/:itemId/:secretKey/:action
. Parameters are as follows:
itemId
: ID of the shared entity. I.e.,68dec092352345009a8a702
secretKey
: secret key of a given shared entityaction
: eithergrant
orrevoke
HTTP request body to be passed should be a JSON which only contains one property, email
. In example, { email: "john@doe.com" }
. This email must belong to a TrendSpider account; otherwise, access won't be granted. It must be a single email address, with no spaces.
The only header required to be passed is content-type: application/json
. Any other headers will be ignored.
Call rate limits
Max request rate is 20 request per minute.
Example responses
- Error, wrong key: returns HTTP 403
{ "success": false, "error":"wrong_secret_key" }
- Error, call rate limit exceeded:
{ "success": false, error: "requests_limit_exceeded" }
- Error, request data validation:
{ error: "body.param is not allowed" }
- Error, other:
{ "success": false, error: <optional error code> }
, no other details will be provided - Success
{ "success":true }
, no other details will be provided
How to obtain API credentials (itemId/secretKey)
Once you share your content item, open the Sharing Management dialog for it again. Above the email list input, you will see a link suggesting you to use an API. Click on this link, and then click "Copy credentials into the Clipboard". Once you do that, you will be able to paste your credentials. Example of credentials copied is 68ded1051e419019e1769316/1dd2c1b9fc246d0d992edbe466818a22
; first part before the slash is itemId
and the second part is secretKey
.
Secret key is unique for each item. If you cancel sharing and then share the same item again, then its secret key will be regenerated.
Example calls
Granting access
curl -X POST 'https://charts.trendspider.com/shared_entities/public/1/access/68ded1051e419019e1769316/1dd2c1b9fc246d0d992edbe466818a22/grant' \
-H 'content-type: application/json' \
-d '{"email": "john@doe.com" }'
Revoking access
curl -X POST 'https://charts.trendspider.com/shared_entities/public/1/access/68ded1051e419019e1769316/1dd2c1b9fc246d0d992edbe466818a22/revoke' \
-H 'content-type: application/json' \
-d '{"email": "john@doe.com" }'