cURL
curl --request PATCH \ --url https://api.example.com/api/church/joinchurch/:id \ --header 'Content-Type: application/json' \ --data ' { "userId": "<string>" } '
{ "success": true, "message": "<string>", "data": { "data._id": "<string>", "data.name": "<string>", "data.address": "<string>", "data.supportcontact": {}, "data.pastor": {} } }
Add an authenticated user to a church’s membership
PATCH /api/church/joinchurch/:id
curl -X PATCH https://api.example.com/api/church/joinchurch/507f191e810c19729de860ea \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \ -H "Content-Type: application/json" \ -d '{ "userId": "507f1f77bcf86cd799439011" }'
{ "success": true, "message": "You have successfully joined Grace Community Church", "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" } } }
{ "success": false, "message": "You are already a member of this church", "data": { "_id": "507f191e810c19729de860ea", "name": "Grace Community Church", "address": "123 Main Street, Springfield, IL 62701", "supportcontact": { "phone": "+1-555-123-4567", "email": "[email protected]" }, "pastor": { "name": "John Smith" } } }
{ "success": false, "message": "Unable to join church", "data": "Church with this Id does not exist" }
{ "success": false, "message": "Unable to join church", "data": "Error message details" }
success: false