The Expirify Client API offers a subset of the full Expirify functionality to allow integration with 3rd party systems.
This API currently offers...
While the Expirify API can be accessed with any programming language that can make web requests, we have only created samples using Javascript because the samples can be executed right in your browser!
All requests to the Expirify are made on behalf of an actual user. First you will need to authorize the user by requesting a bearer token. Once you have a bearer token, you pass that token as header with the request. Any request will be processed as the user who requested the bearer token.
Bearer tokens expire after 18 hours, at which point you will need to request a new one. Once a token has been issued, it cannot be revoked until is has expired.
When requesting a bearer token, you have 2 choices. You can redirect the user to a page hosted by
Expirify where they can safely enter their credentials. Or you can request a token directly
by posting to /Token
. This is usually only required when doing server to server
integration or when creating native applications.
https://api.expirify.com/account/login?redirect_url=/http://yourdomain.com/pageWithinYourApp.html
where "redirect_url" is an absolute url to a page on your site.
?access_token=abc123etc
appended.
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
var token = getParameterByName('access_token');
/Token
with the following data
{
grant_type: 'password',
username: loginName,
password:password
}
access_token
property
We support both XML and JSON request/response formats. Make sure to supply the correct accept
header when making your request. Json is the default data format.
Once you have your bearer token, you are ready to make your first call to the API.
var headers = {};
headers.Authorization = 'Bearer ' + token;
$.ajax({
type: 'GET',
url: 'https://api.expirify.com/api/Domain',
headers: headers
}).done(function (data) {
console.log(data);
}).fail(console.log);