cURL
curl --request POST \ --url https://api.example.com/api/church/createchurch/:pastorId \ --header 'Content-Type: application/json' \ --data ' { "name": "<string>", "address": "<string>", "supportcontact": { "supportcontact.phone": "<string>", "supportcontact.email": "<string>", "supportcontact.website": "<string>" } } '
{ "success": true, "message": "<string>", "data": { "data._id": "<string>", "data.name": "<string>", "data.address": "<string>", "data.supportcontact": {}, "data.pastor": {}, "data.members": [ {} ] } }
Create a new church with the authenticated pastor as the administrator
pastor
POST /api/church/createchurch/:pastorId
curl -X POST https://api.example.com/api/church/createchurch/507f1f77bcf86cd799439011 \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \ -H "Content-Type: application/json" \ -d '{ "name": "Grace Community Church", "address": "123 Main Street, Springfield, IL 62701", "supportcontact": { "phone": "+1-555-123-4567", "email": "[email protected]", "website": "https://gracechurch.org" } }'
{ "success": true, "message": "Church Created", "data": { "_id": "507f191e810c19729de860ea", "name": "Grace Community Church", "address": "123 Main Street, Springfield, IL 62701", "supportcontact": { "phone": "+1-555-123-4567", "email": "[email protected]", "website": "https://gracechurch.org" }, "pastor": { "name": "John Smith", "phoneNumber": "+1-555-987-6543", "authDetails": { "email": "[email protected]", "role": "pastor" } }, "members": [ { "name": "John Smith", "phoneNumber": "+1-555-987-6543", "authDetails": { "email": "[email protected]", "role": "pastor" } } ] } }
{ "success": false, "message": "Church Name Already exists", "data": { "_id": "507f191e810c19729de860ea", "name": "Grace Community Church", "address": "123 Main Street, Springfield, IL 62701", "supportcontact": { "phone": "+1-555-123-4567", "email": "[email protected]" }, "pastor": {}, "members": [] } }
{ "success": false, "message": "Access Denied", "data": "The role 'member' is not allowed for this route" }
{ "success": false, "message": "Church Creation not successful", "data": "Validation error message or server error details" }
members