Quickstart
Who can do this: integrators.
This walks an impersonating client — a server application searching for your
users — from a token to a document. Replace acme with your tenant’s
address name.
1. Register the client
Section titled “1. Register the client”A user admin registers an impersonating client, creates a secret and relates the client to the users or groups it may act for; see Client applications. You get a Client ID and a secret.
2. Get a token for a user
Section titled “2. Get a token for a user”curl -s https://acme.contentsurface.io/oauth/token \ -u "$CLIENT_ID:$CLIENT_SECRET" \ -d grant_type=urn:ietf:params:oauth:grant-type:token-exchange \ -d subject_token=usr_… \ -d subject_token_type=urn:contentsurface:token-type:user-id \ -d scope=cs.contentThe answer holds an access_token for 15 minutes. It reads exactly what that
user may read.
3. Search
Section titled “3. Search”curl -s https://api.contentsurface.io/v1/search \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "text": "invoices March", "filters": { "type": ["File"] }, "passages": 1 }'Each item has an id, name, path, attributes, and the matching passages.
4. Open a result
Section titled “4. Open a result”For your own server, stream the content:
curl -s https://api.contentsurface.io/v1/nodes/nod_…/content \ -H "Authorization: Bearer $TOKEN" -o result.pdfTo let the user’s browser download it without a token, ask for a content link and hand it over; it works for a few minutes and is checked again on use:
curl -s https://api.contentsurface.io/v1/nodes/nod_…/content-link \ -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \ -d '{ "expiresInMinutes": 5 }'- Browse folders: a search without text, with
includeDescendants: falseand one folder; see Browsing. - Filters, modes and paging: Searching and the search operation.
- API essentials for paging, errors and limits.
In the API
The Portal does this through these calls; an integration can make them directly.