Version 3.0 of the RegattaCentral APIs uses the industry standard OAuth2 protocol to provide secure authorization to endpoints requiring authorization. Therefore before a secured call can be made, an authorization token must be requested and for all secure calls sent as an Authentication header.
To use the OAuth2 apis, you will need a client_id and client_secret which you can request by email [email protected]. In addition, you will need to have an account with www.regattacentral.com.
WARNING: Your client_id, client_secret, username and password must always be kept secure and not shared with anybody or exposed over the Internet.
This service must be called prior to all secure calls in order to retrieve an authorization token. This authorization token can then be passed as an Authorization header to all secure calls. The results also includes a expiration time for the authorization token. A refresh token is also included in case the authorization token expires prior to the finishing the use of the API, the refresh token can be used to obtain a new authorization token (see Refresh Token).
URL: https://api.regattacentral.com/oauth2/api/token
POST body
client_id={Client_id}&client_secret={Client_secret}&username={Username}&password={Password}&grant_type=password
Client_id
An application specific id that must be obtained from RegattaCentral.
Client_secret
An application specific secret that must be obtained from RegattaCentral.
Username
Valid RegattaCentral username.
Password
Password associated with the RegattaCentral username.
Response
{ "access_token":"8ce2bba001c2d6153cb04e4a2ffa1ca3" "expires_in":3600, "refresh_token":"f7d338c11a68cf55b804eda19776eadc", }
access_token
The authorization token that must be passed in the Authorization header for all secure calls.
expires_in
Number of seconds before access_token expires.
refresh_token
A token that can be used to get a new access_token when the current token expires
(see Refresh Token).
$.ajax({
type: "POST",
url: 'https://api.regattacentral.com/oauth2/api/token',
data: 'client_id={client_id}&client_secret={client_secret}&username={username}&password={password}&grant_type=password',
success: function (data) {
// Process & Display Data
},
error: function () {
alert('Error processing request.');
}
});
This service may be called to retrieve a new token based on the refresh token. This allows you to re-authenticate without having to prompt and pass the username and password.
URL: https://api.regattacentral.com/oauth2/api/token
POST body
client_id={Client_id}&client_secret={Client_secret}&refresh_token={Refresh_token}&grant_type=refresh_token
Client_id
An application specific id that must be obtained from RegattaCentral.
Client_secret
An application specific secret that must be obtained from RegattaCentral.
Refresh_token
The refresh_token that was issued with the original token request.
Response
{ "expires_in":3600, "access_token":"962bd83b5b2ed047e0c1413f0b7a019d" }
access_token
The new authorization token that must be passed in the Authorization header for all secure calls.
expires_in
Number of seconds before access_token expires.
$.ajax({
type: "POST",
url: 'https://api.regattacentral.com/oauth2/api/token',
data: 'client_id={client_id}&client_secret={client_secret}&refresh_token={refresh_token}&grant_type=refresh_token',
success: function (data) {
// Process & Display Data
},
error: function () {
alert('Error processing request.');
}
});
This service may be used to verify that a token is still valid.
URL: https://api.regattacentral.com/oauth2/api/validate
POST body
token={Token}
Token
A previously generated token generated by the RegattaCentral OAuth process.
Response
{ "username":"[email protected]", "access_token":"8ce2bba001c2d6153cb04e4a2ffa1ca3" }
access_token
The authorization token that was verified.
username
The username that was used to create the token.
$.ajax({
type: "POST",
url: 'https://api.regattacentral.com/oauth2/api/validate',
data: 'token={token}',
success: function (data) {
// Process & Display Data
},
error: function () {
alert('Error processing request.');
}
});