Skip to content

Knowledge base/API

API v2.0

Jan 12

This document describes the v2 API of Currinda. This API is focused on the accessing of resources pertaining to associations/organisations within the Currinda database.

Please note that parts of this are currently under development and can not be considered stable. Stable endpoints will be marked as such.

API Access

API Access is controlled by each Currinda site. Each client will provide OAuth Client ID and Client Secret information.

URLs

All URLs in this document are based on the root domain of the site. This is usually in the format https://{currinda_site}.currinda.com/

Authentication

Authentication to the API is handled with OAuth2. The majority of endpoints are accessible with the client credentials grant type. There is also the availability of the OAuth2 authorization code grant type. This allows for the possibility of single sign-on. See guidelines for single sign-on integration.

Token

GET /api/v2/organisation/{organisation_id}/token

This is the token endpoint. Requests to this with a valid client id and secret will return the necessary authorization code.

$ curl -u TestClient:TestSecret https://acme.currinda.com/api/v2/organisation/100/token -d 'grant_type=client_credentials&scope=members'
{"access_token":"03807cb390319329bdf6c777d4dfae9c0d3b3c35","expires_in":3600,"token_type":"bearer","scope":null}

This access token should then be used in the Authorization header for any further requests:

curl -H "Authorization: Bearer 03807cb390319329bdf6c777d4dfae9c0d3b3c35" https://acme.currinda.com/api/v2/organisation/100/members

Authorize

GET /api/v2/organisation/{organisation_id}/authorize

Authorization Codes are retrieved using the Authorize Controller. The client must send the user to the OAuth server's authorize URL.

First, redirect the user to the following URL:

https://{currinda_site}/api/v2/organisation/{organisation_id}/authorize?response_type=code&client_id=TestClient&redirect_uri=https://myredirecturi.com/cb

A successful authorization will pass the client the authorization code in the URL via the supplied redirect_uri:

https://myredirecturi.com/cb?code=SplxlOBeZQQYbYS6WxSbIA&state=xyz

Once this is done, a token can be requested using the authorization code.

$ curl -u TestClient:TestSecret https://api.mysite.com/token -d 'grant_type=authorization_code&code=xyz'

A successful token request will return a standard access token in JSON format:

{"access_token":"03807cb390319329bdf6c777d4dfae9c0d3b3c35","expires_in":3600,"token_type":"bearer","scope":null}

Resources

Logged in user information

This is to be used with the authorization code grant type as described above.

GET /api/v2/organisation/{organisation_id}/user

Scope Required: user

List memberships in Organisation (Stable)

GET /api/v2/organisation/{organisation_id}/members

Scope Required: members

GET Parameters: MembershipCategory[], MembershipType[], OrganisationChapter[], FinancialStatus[] (default: financial — financial, expired, expiring, outstanding), ExpiryDate[To], ExpiryDate[From], CurrentAddons[], ExtraAnswer[], Searchable, Locations, User[FirstName], User[LastName], User[State], User[Country], User[Organisation], DateModified[After], DateModified[Before].

List membership categories in Organisation (Stable)

GET /api/v2/organisation/{organisation_id}/categories

Scope Required: basic

List membership types in Organisation (Stable)

GET /api/v2/organisation/{organisation_id}/membershiptypes

Scope Required: basic. GET Parameters: Visible (boolean, default: true), Searchable (boolean).

List addons in Organisation (Stable)

GET /api/v2/organisation/{organisation_id}/addons

Scope Required: basic. GET Parameters: Visible (boolean, default: true), Searchable (boolean).

List extras in Organisation (Stable)

GET /api/v2/organisation/{organisation_id}/extras

Scope Required: basic. GET Parameters: Searchable (boolean).

Search locations of an Organisation (Beta)

GET /api/v2/organisation/{organisation_id}/locations

Scope Required: members. GET Parameters: Geolocation[Lat], Geolocation[Lng], Geolocation[Distance] (default: 50, float), Name (string), State (string). All parameters available on the members endpoint are also available.