API Documentation


API Libraries

To access the API we've built a PHP SDK library.

In addition, we've created a "plug & play" jQuery widget (example) which can be dropped onto any HTML page for an instant player.

PHP Library jQuery Widget

The documentation below explains how to use the API, with code examples for the PHP SDK library.


Authentication

All API requests must include a HAWK authentication header. Hawk is an HTTP authentication scheme using a message authentication code (MAC) algorithm.

Using your application's public & private key HAWK will hash your URL and payload for authentication. This stops "man in the middle" attacks. The nonce and time stamp stops replay-attacks.

Visit the 'Applications' page to generate your public & private API keys.

Once you have application credentials, you can use our API debugger to run test API requests.

API debugger


Talks

GET
GET https://api.mychurch.media/talks/
Params
PHP Example
Response
Params Type Description
book_id Integer ID of the Bible book
book_slug String Slug of the Bible book (eg: "genesis")
chapter Integer Chapter number
verse Integer Verse number
service_id Integer ID of the service
series_id Integer ID of the series
speaker_id Integer ID of the speaker
q String Search term to match title, desctiption, series or speaker.
limit Integer Limit the number of results returned (1 - 100)
offset Integer Specifies how many results to skip. Defaults to 0
sort_by String Order by the specified attribute. Defaults to ID
sort_order String The sort order in which the results should be ordered. ASC or DESC. Defaults to ASC
is_archived Integer Request archived or not archived results (eg: 0 or 1)
PHP Example

$mcm = new MyChurchMedia();

$mcm->get( 'talks', $params );

JSON Response
{
"rows": [{
"id": "123",
"date": "2014-08-27 09:20:51",
"title": "Talk Title",
"slug": "isaiah-42",
"description": "Description of talk.",
"is_thematic": null,
"book_id": "1",
"chapter_start": "1",
"chapter_end": "1",
"verse_start": "1",
"verse_end" :"1",
"passage": "Deuteronomy",
"speaker_id": "1",
"series_id": "1",
"service_id": "1",
"filename": "09d11aa4d832cc1ce431743c1ec3dc1f.mp3",
"size": "198658",
"duration": null,
"mime_type": "audio/mpeg",
"extension": "mp3",
"tags": "['gospel','scared']",
"is_archived": "1",
"updated_by": "1",
"created_by": "1",
"downloads": "1",
"is_featured": "1",
"organisation_id": "1",
"updated_at": "2014-08-27 09:28:51",
"created_at": "2012-03-19 17:35:40",
"artwork": null,
"audio": "https://assets.mychurch.media/audio/48/isaiah-42.mp3",
"speaker_name": "John Smith",
"speaker_is_archived": "0",
"speaker_affiliation": "Charity",
"speaker_is_guest": "0",
"book_name": "Deuteronomy",
"book_slug": "deuteronomy",
"series_name": "Series Title",
"series_slug": "series-title",
"organisation_name": "Organisation Name",
"organisation_slug": "organisation-name",
"organisation_is_archived": "0",
"service_name": "Service name"
}],
"total": 100
}
GET https://api.mychurch.media/talks/ID/
Params
PHP Example
Response
Params Type Description
No parameters are required.
PHP Example

$mcm = new MyChurchMedia();

$mcm->get( 'talks', $id );

JSON Response
{
"id": "123",
"date": "2014-08-27 09:20:51",
"title": "Talk Title",
"slug": "isaiah-42",
"description": "Description of talk.",
"is_thematic": null,
"book_id": "1",
"chapter_start": "1",
"chapter_end": "1",
"verse_start": "1",
"verse_end" :"1",
"passage": "Deuteronomy",
"speaker_id": "1",
"series_id": "1",
"service_id": "1",
"filename": "09d11aa4d832cc1ce431743c1ec3dc1f.mp3",
"size": "198658",
"duration": null,
"mime_type": "audio/mpeg",
"extension": "mp3",
"tags": "['gospel','scared']",
"is_archived": "1",
"updated_by": "1",
"created_by": "1",
"downloads": "1",
"is_featured": "1",
"organisation_id": "1",
"updated_at": "2014-08-27 09:28:51",
"created_at": "2012-03-19 17:35:40",
"artwork": null,
"audio": "https://assets.mychurch.media/audio/48/isaiah-42.mp3",
"speaker_name": "John Smith",
"book_name": "Deuteronomy",
"book_slug": "deuteronomy",
"series_name": "Series Title",
"series_slug": "series-title",
"organisation_name": "Organisation Name",
"organisation_slug": "organisation-name",
"organisation_is_archived": "0",
"service_name": "Service name"
}
POST
POST https://api.mychurch.media/talks/
Params
PHP Example
Response
Params Type Description
date * Date Date of the talk
title * String Title of talk
speaker_id * Integer ID of the speaker
series_id * Integer ID of the series
service_id * Integer ID of the service
book_id Integer ID of the Bible book
chapter_start Integer Beginning Bible chapter
chapter_end Integer Ending Bible chapter
verse_start Integer Beginning Bible verse
verse_end Integer Ending Bible verse
description String Description of the talk's content
is_thematic Bit Mark as 1 if talk is thematic
is_featured Bit Mark as 1 if talk is featured
is_archived Bit Mark as 1 to archive talk
tags JSON string JSON array of tags (eg: "['gospel','scared']")
PHP Example

$mcm = new MyChurchMedia();

$mcm->post( 'talks', $payload );

JSON Response
{
"id": "123"
}
PUT
PUT https://api.mychurch.media/talks/ID/
Params
PHP Example
Response
Params Type Description
date Date Date of the talk
title String Title of talk
speaker_id Integer ID of the speaker
series_id Integer ID of the series
service_id Integer ID of the service
book_id Integer ID of the Bible book
chapter_start Integer Beginning Bible chapter
chapter_end Integer Ending Bible chapter
verse_start Integer Beginning Bible verse
verse_end Integer Ending Bible verse
description String Description of the talk's content
is_thematic Bit Mark as 1 if talk is thematic
is_archived Bit Mark as 1 to archive talk
is_featured Bit Mark as 1 to feature talk
tags JSON string JSON array of tags
PHP Example

$mcm = new MyChurchMedia();

$mcm->put( 'talks', $id, $payload );

JSON Response
{
"id": "123"
}
PUT https://api.mychurch.media/talks/ID/audio/
Params
PHP Example
Response
Params Type Description
file * String Base encoded string of file
size * Integer File size is bytes
PHP Example

$mcm = new MyChurchMedia();

$mcm->put( 'talks', $id, $payload, 'audio' );

JSON Response
{
"id": "123"
}
DELETE
DELETE https://api.mychurch.media/talks/ID/
Params
PHP Example
Response
Params Type Description
No parameters are required.
PHP Example

$mcm = new MyChurchMedia();

$mcm->delete( 'talks', $id );

JSON Response
{
"id": "123"
}

Series

GET
GET https://api.mychurch.media/series/
Params
PHP Example
Response
Params Type Description
limit Integer Limit the number of results returned (1 - 100)
offset Integer Specifies how many results to skip. Defaults to 0
sort_by String Order by the specified attribute. Defaults to ID
sort_order String The sort order in which the results should be ordered. ASC or DESC. Defaults to ASC
is_archived Integer Request archived or not archived results (eg: 0 or 1)
PHP Example

$mcm = new MyChurchMedia();

$mcm->get( 'series', $params );

JSON Response
{
"rows": [{
"id": "123",
"name": "Series title",
"slug": "series-title",
"filename": "72b2d89613a1f2d1578b661f2a0e2cde.jpg",
"description": "Description of sermon series.",
"organisation_id": "1",
"is_archived": "1",
"updated_by": "1",
"created_by": "1",
"updated_at": "2014-08-08 09:45:08",
"created_at": "2012-03-19 17:37:32",
"artwork": "http:\/\/media.sermondb.dev\/series\/123\/series-title.jpg"
}],
"total": 100
}
GET https://api.mychurch.media/series/ID/
Params
PHP Example
Response
Params Type Description
No parameters are required.
PHP Example

$mcm = new MyChurchMedia();

$mcm->get( 'series', $id );

JSON Response
{
"id": "123",
"name": "Series title",
"slug": "series-title",
"filename": "72b2d89613a1f2d1578b661f2a0e2cde.jpg",
"description": "Description of sermon series.",
"organisation_id": "1",
"is_archived": "1",
"updated_by": "1",
"created_by": "1",
"updated_at": "2014-08-08 09:45:08",
"created_at": "2012-03-19 17:37:32",
"artwork": "http:\/\/media.sermondb.dev\/series\/123\/series-title.jpg"
}
POST
POST https://api.mychurch.media/series/
Params
PHP Example
Response
Params Type Description
name * String Name of service
is_archived Bit Mark as 1 to archive service
PHP Example

$mcm = new MyChurchMedia();

$mcm->post( 'series', $payload );

JSON Response
{
"id": "123"
}
PUT
PUT https://api.mychurch.media/series/ID/
Params
PHP Example
Response
Params Type Description
name String Name of service
is_archived Bit Mark as 1 to archive series
PHP Example

$mcm = new MyChurchMedia();

$mcm->put( 'series', $id, $payload );

JSON Response
{
"id": "123"
}
PUT https://api.mychurch.media/series/ID/image/
Params
PHP Example
Response
Params Type Description
file * String Base encoded string of file.
300px by 300px.
size * Integer File size is bytes
PHP Example

$mcm = new MyChurchMedia();

$mcm->put( 'series', $id, $payload, 'image' );

JSON Response
{
"id": "123"
}
DELETE
DELETE https://api.mychurch.media/series/ID/
Params
PHP Example
Response
Params Type Description
No parameters are required.
PHP Example

$mcm = new MyChurchMedia();

$mcm->delete( 'series', $id );

JSON Response
{
"id": "123"
}

Speakers

GET
GET https://api.mychurch.media/speakers/
Params
PHP Example
Response
Params Type Description
limit Integer Limit the number of results returned (1 - 100)
offset Integer Specifies how many results to skip. Defaults to 0
sort_by String Order by the specified attribute. Defaults to ID
sort_order String The sort order in which the results should be ordered. ASC or DESC. Defaults to ASC
is_archived Integer Request archived or not archived results (eg: 0 or 1)
PHP Example

$mcm = new MyChurchMedia();

$mcm->get( 'speakers', $params );

JSON Response
{
"rows": [{
"id": "123",
"name": "John Smith",
"affiliation": "Organisation name",
"is_guest": "1",
"organisation_id": "1",
"is_archived": "0",
"updated_by": "1",
"created_by": "1",
"updated_at": "2014-08-29 09:30:02",
"created_at": "2012-03-19 17:36:25"
}],
"total": 100
}
GET https://api.mychurch.media/speakers/ID/
Params
PHP Example
Response
Params Type Description
No parameters are required.
PHP Example

$mcm = new MyChurchMedia();

$mcm->get( 'speakers', $id );

JSON Response
{
"id": "123",
"name": "John Smith",
"affiliation": "Organisation name",
"is_guest": "1",
"organisation_id": "1",
"is_archived": "0",
"updated_by": "1",
"created_by": "1",
"updated_at": "2014-08-29 09:30:02",
"created_at": "2012-03-19 17:36:25"
}
POST
POST https://api.mychurch.media/speakers/
Params
PHP Example
Response
Params Type Description
name * String Name of service
affiliation String Name of affiliated organisation
is_guest Bit Mark as 1 to denote guest speaker
is_archived Bit Mark as 1 to archive speaker
PHP Example

$mcm = new MyChurchMedia();

$mcm->post( 'speakers', $payload );

JSON Response
{
"id": "123"
}
PUT
PUT https://api.mychurch.media/speakers/ID/
Params
PHP Example
Response
Params Type Description
name String Name of service
affiliation String Name of affiliated organisation
is_guest Bit Mark as 1 to denote guest speaker
is_archived Bit Mark as 1 to archive speaker
PHP Example

$mcm = new MyChurchMedia();

$mcm->put( 'speakers', $id, $payload );

JSON Response
{
"id": "123"
}
DELETE
DELETE https://api.mychurch.media/speakers/ID/
Params
PHP Example
Response
Params Type Description
No parameters are required.
PHP Example

$mcm = new MyChurchMedia();

$mcm->delete( 'speakers', $id );

JSON Response
{
"id": "123"
}

Services

GET
GET https://api.mychurch.media/services/
Params
PHP Example
Response
Params Type Description
limit Integer Limit the number of results returned (1 - 100)
offset Integer Specifies how many results to skip. Defaults to 0
sort_by String Order by the specified attribute. Defaults to ID
sort_order String The sort order in which the results should be ordered. ASC or DESC. Defaults to ASC
is_archived Integer Request archived or not archived results (eg: 0 or 1)
PHP Example

$mcm = new MyChurchMedia();

$mcm->get( 'services', $params );

JSON Response
{
"rows": [{
"id": "123",
"name": "Cornerstone AM",
"organisation_id": "1",
"is_archived": "0",
"updated_by": 1,
"created_by": 1,
"updated_at": "2014-08-29 09:49:12",
"created_at": "2012-03-19 15:41:25"
}],
"total": 100
}
GET https://api.mychurch.media/services/ID/
Params
PHP Example
Response
Params Type Description
No parameters are required.
PHP Example

$mcm = new MyChurchMedia();

$mcm->get( 'services', $id );

JSON Response
{
"id": "123",
"name": "Morning Service",
"organisation_id": "1",
"is_archived": "0",
"updated_by": "1",
"created_by": "1",
"updated_at": "2014-08-29 09:49:12",
"created_at": "2012-03-19 15:41:25"
}
POST
POST https://api.mychurch.media/services/
Params
PHP Example
Response
Params Type Description
name * String Name of service
is_archived Bit Mark as 1 to archive service
PHP Example

$mcm = new MyChurchMedia();

$mcm->post( 'services', $payload );

JSON Response
{
"id": "123"
}
PUT
PUT https://api.mychurch.media/services/ID/
Params
PHP Example
Response
Params Type Description
name String Name of service
is_archived Bit Mark as 1 to archive service
PHP Example

$mcm = new MyChurchMedia();

$mcm->put( 'services', $id, $payload );

JSON Response
{
"id": "123"
}
DELETE
DELETE https://api.mychurch.media/services/ID/
Params
PHP Example
Response
Params Type Description
No parameters are required.
PHP Example

$mcm = new MyChurchMedia();

$mcm->delete( 'services', $id );

JSON Response
{
"id": "123"
}

Books

GET
GET https://api.mychurch.media/books/
Params
PHP Example
Response
Params Type Description
limit Integer Limit the number of results returned (1 - 100)
offset Integer Specifies how many results to skip. Defaults to 0
sort_by String Order by the specified attribute. Defaults to ID
sort_order String The sort order in which the results should be ordered. ASC or DESC. Defaults to ASC
is_archived Integer Request archived or not archived results (eg: 0 or 1)
PHP Example

$mcm = new MyChurchMedia();

$mcm->get( 'books', $params );

JSON Response
{
"rows": [{
"id": "1",
"abbr": "Ge",
"volume": "Old Testament",
"name": "Genesis",
"slug": "genesis",
"is_archived": "0"
}],
"total": 10
}
GET https://api.mychurch.media/books/ID/
Params
PHP Example
Response
Params Type Description
No parameters are required.
PHP Example

$mcm = new MyChurchMedia();

$mcm->get( 'books', $id );

JSON Response
{
"id": "1",
"abbr": "Ge",
"volume": "Old Testament",
"name": "Genesis",
"slug": "genesis",
"is_archived": "0"
}

Organisations

GET
GET https://api.mychurch.media/organisations/ID/
Params
PHP Example
Response
Params Type Description
No parameters are required.
PHP Example

$mcm = new MyChurchMedia();

$mcm->get( 'organisation', $id );

JSON Response
{
"id": "1",
"name": "Organisation Name",
"slug": "organisation-name",
"filename": "4e80b75c3d4ed302ab23cdb66dcfeb6a.jpg",
"description": "Organisation description",
"is_archived": "0",
"updated_by": "1",
"created_by": "1",
"updated_at": "2014-09-03 15:01:59",
"created_at": "2014-07-21 14:05:32",
"artwork": "https://assets.mychurch.media/organisation/1/organisation-name.jpg",
"feed": "https://rss.mychurch.media/1/organisation-name/"
}