Authentication
Version 26.1.9516
Version 26.1.9516
Authentication
The CData Sync REST API V2 uses an authentication (auth) token to authenticate requests. Each API request must include a valid auth token by using one of the supported authentication methods.
Supported Authentication Methods
You can authenticate REST API V2 requests using either of the following methods:
-
Auth Token header: Send the token in the
x-cdata-authtokenrequest header. -
HTTP Basic authentication: Send the token as the password in an HTTP Basic authentication header.
Method 1: Including the Auth-Token in the Request Header
Include the AuthToken value in the x-cdata-authtoken request header.
Example
GET /api.rsc/v2/workspaces HTTP/1.1
Host: <Sync-Host>
x-cdata-authtoken: <AuthToken>
Accept: application/json
Method 2: HTTP Basic Authentication
Send the AuthToken value as the password in an HTTP Basic authentication header. The username can be any value.
Example
GET /api.rsc/v2/workspaces HTTP/1.1
Host: <Sync-Host>
Authorization: Basic <base64(Username:AuthToken)>
Accept: application/json
Auth Token Generation
REST API 2.0 provides the following endpoint that enables you to generate an auth token:
POST api.rsc/v2/users/generate-token
You can use the token that is returned by this endpoint with either authentication method.