Prayer Cloud API

Empowering your ministry in the cloud


Creating a Church

Field Type Required Description
Name string Yes The name of the church
email string Yes A contact email address for the church. This email will receive notifications of prayer submissions.
postal_code string Yes The postal code of where the church is located.

To create a new church under your account you will submit an authenticated POST request to https://prayer.ministrycloud.com/api/churches with the following json form data

{
  "name":       "Simple Site",
  "email":      "office@simplesite.com",
  "potal_code": "92110"
}

If successful you will receive a 201 response with the following JSON body. Take note of the uuid and the api_key as these will be needed to interact with most authenticated prayer endpoints. The api_key will never be displayed again, so this is your one chance to store the key.

The api_key will expire after 1 year. Track the date it was last updated and make sure you implement a mechanism for renewing keys, such as a cron job. See Authentication for how to generate a new api_key.

{
    "data": {
        "uuid": "8b7ecc6f-e5a3-4998-b04e-483d8ec0bc11",
        "name": "Simple Site",
        "contacts": [
            {
                "email": "office@simplesite.com",
                "created_at": {
                    "date": "2018-08-08 22:25:20.000000",
                    "timezone_type": 3,
                    "timezone": "UTC"
                },
                "updated_at": {
                    "date": "2018-08-08 22:25:20.000000",
                    "timezone_type": 3,
                    "timezone": "UTC"
                }
            }
        ],
        "address": {
            "postal_code": "92110"
        }
    },
    "meta": {
        "member_since": {
            "date": "2018-08-08 22:25:20.000000",
            "timezone_type": 3,
            "timezone": "UTC"
        },
        "admins": [
            {
                "name": "Ekklesia 360",
                "contact": {
                    "email": "engineering@monkdevelopment.com"
                }
            },
            {
                "name": "Simple Site",
                "contact": {
                    "email": "office@simplesite.com"
                }
            }
        ],
        "api_key": "your-api-key-will-be-here"
    }
}

Updating a Church

Field Type Required Description
Name string No The name of the church
postal_code string No The postal code of where the church is located.

If a null or empty value is passed in the request it will be filtered out, rather than throwing an error, because we only update values that have data.

To update a church under your account you will submit an authenticated PATCH request to https://prayer.ministrycloud.com/api/churches/{{church}} with the following json form data

{
  "name":       "Simple Site",
  "postal_code": "92110"
}

If successful you will receive a 204 response.

Adding and Removing a Contact

When a prayer is submitted for a church all of the contacts for a church are notified of the prayer. A church can have an unlimited number of contacts. The content of the prayer sent to this list is dictated by the prayers Authorization Types

Adding

To add a contact to a church with the API you will submit an authenticated POST request to https://prayer.ministrycloud.com/api/churches/{{church}}/contacts.
{{church}} is the UUID of the church.

Field Type Required Description
email string Yes A contact email address for the church. This email will receive notifications of prayer submissions.

{
  "email":      "pastor@simplesite.com",
}

If successful you will receive a 201 response with the following JSON body.

{
    "data": {
        "contacts": [
            {
                "email": "pastor@simplesite.com",
                "created_at": {
                    "date": "2018-08-08 22:25:20.000000",
                    "timezone_type": 3,
                    "timezone": "UTC"
                },
                "updated_at": {
                    "date": "2018-08-08 22:25:20.000000",
                    "timezone_type": 3,
                    "timezone": "UTC"
                }
            },
            {
                "email": "office@simplesite.com",
                "created_at": {
                    "date": "2018-08-08 22:30:12.000000",
                    "timezone_type": 3,
                    "timezone": "UTC"
                },
                "updated_at": {
                    "date": "2018-08-08 22:30:12.000000",
                    "timezone_type": 3,
                    "timezone": "UTC"
                }
            }
        ],

    },
    "meta": {
        "church": {
            "uuid": "8b7ecc6f-e5a3-4998-b04e-483d8ec0bc11",
            "name": "Simple Site",
        }
    }
}

Removing

To remove a contact to a church with the API you will submit an authenticated DELETE request to https://prayer.ministrycloud.com/api/churches/{{church}}/contacts/{{email}}.
{{church}} is the UUID of the church and {{email}} is the email being removed.


$url = "https://prayer.ministrycloud.com/api/churches/8b7ecc6f-e5a3-4998-b04e-483d8ec0bc11/contacts/pastor@simplechurch.com";
$response = Requests::delete($url, array(
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer your-api-token',
));

if ($response->success !== true) {
  throw new Exception('There was an error removing this church contact.');
}