Skip to content

Latest commit

 

History

History
76 lines (63 loc) · 2.81 KB

File metadata and controls

76 lines (63 loc) · 2.81 KB
title Api Integration

API Integration

NB. We recommend that you use webhooks to keep your system up to date with the Members data, as this will relieve the load from the API. But you are still welcome to use the API

Menu

Integrating with the Members API

Please read the Getting Started section before going through this page. Once scopes have been approved for your client (application) you can integrate with the members api.

Authentication and Authorization to the API

It is currently only possible to get access to the API via an API Key. OAuth2 support will come soon.

API-key

  1. To get access to your API key, please navigate to your organization click on the "Applications" tab, then on the application you want to work with and then the "Data Access" tab image
  2. On the "Data Access" page you should see the section for API Keys image

Code snippets

For these example we are using the node-fetch npm package

Example 1 - Get a person given his personID

const fetch = require('node-fetch');
    try {
        let httpResponse = await fetch('https://members.bcc.no/person?personID=12345',
            {
                method: 'get',
                headers:
                    {   'Content-Type': 'application/json',
                        'x-access-token':'API-KEY-HERE'
                    }
            })

        const result = await httpResponse.json()
        const person = result.data[0]
        console.log('Person retrieved from the members api', JSON.stringify(person))

    } catch (error) {
        console.log(error.message)
    }

Example 2 - Get all people from Oslo/Follo (churchID = 69)

const fetch = require('node-fetch');
    try {
        let httpResponse = await fetch('https://members.bcc.no/person?churchID=69&$limit=50&$skip=0',
            {
                method: 'get',
                headers:
                    {   'Content-Type': 'application/json',
                        'x-access-token':'API-KEY-HERE'
                    }
            })

        const result = await httpResponse.json()
        const everybodyFromOsloFollo = result.data
        console.log('Fifty people retrieved in Oslo/Follo from the members API', JSON.stringify(everybodyFromOsloFollo))

    } catch (error) {
        console.log(error.message)
    }

OAuth2

Coming soon