ContentSync Logo

REST Client

This is the typed version of the REST client that’s using the auto-generated rest-schema.ts to provide rich typing and autocompletes.

The fetch-based client has 0 dependencies itself and works both in Node.js and browsers, but if you’d like to leverage self-signed JWTs, please add the jsonwebtoken module to your project.

If you are not passing in a baseUrl option, be sure to add it as an environment variable, e.g.:

  • CC_SATELLITE_BASE_URL=https://abc-def.live.cloud.content-sync.io/latest/rest

    • You can copy the URL from the REST explorer.

    • Part of the URL is the API service, like preview, live or cdn.

Update your local project using the Content Cloud CLI:

Terminal
# - Generate the schema for the REST API in TypeScript # - Download the generic REST client code # Code is downloaded to the app/content-cloud folder. You may want to change this if you're using e.g. src/ instead of app/ for your project. content-cloud generate rest typescript -o app/content-cloud --client-code

The following files will be generated for the client:

content-cloud-system-rest-client.ts

View

content-cloud-rest-client.ts

View