Ministry Sync Developer Resources
Menu

XML API - Introduction

How to utilize our Legacy XML-based API

Introduction

Ministry sync offers an XML-based API to allow for access and control of Ministry Sync features from your own server. The following is a brief overview of how to work with the XML Api within Ministry Sync. This documentation assumes familiarity with RESTful endpoints and services.

The Endpoint

The XML api operates off of a single endpoint.

https://secure.ministrysync.com/ministrysync/api/post.php

You will make a POST request to the endpoint with several required parameters. Note: other parameters may be required based on the action.

Required Field Description
APIUsername api username
APIPassword api password
APIKey api access key
Action action to take See available actions

Example in PHP

Step 1

Copy this Function Into Your PHP Code

function SendPostRequest($url, $postParams)

{

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $postParams);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$page = curl_exec($ch);



if (curl_errno($ch)) {

print curl_error($ch);

die();

} else {

curl_close($ch);

}

return $page;

}

Step 2

Calling the Api

// First, setup the data you will post:

$post_data["APIUsername"] = ""; // enter your api username

$post_data["APIPassword"] = ""; // enter your api password

$post_data["APIKey"] = ""; // enter your api key

$post_data["Action"] = ""; // enter the function you want to call

$post_data["any_other_data_required_by_docs"] = "";

// Call MS API

$post_url = "https://secure.ministrysync.com/ministrysync/api/post.php";

$response = SendPostRequest($post_url, $post_data);

$xml = new SimpleXMLElement($response);

// RETURNED ERROR?

if ($xml->Status->ErrorCode < 0)

die($xml->Status->Description);

Step 3

Working with the Data


// LOOP THROUGH RESULTS
foreach ($xml->Events->children() as $Event)
{
// work with the data
echo $Event->Title;
}

Copyright © 2019 Ministry Sync. All rights reserved.