Skip to content

Systems API

ardeearam edited this page Jan 23, 2015 · 9 revisions

/systems

Internal methods and functionalities to keep GCore running smoothly. Includes synchronization, backup, health checks, and other functionalities used internally by the system.

POST /systems/emails

Send an email with "gcoreapi@gmail.com" as sender.

Body Parameters

  • to - Email address of recepient. Example: recepient@email.com
  • subject - Email subject. Example: Re: Friday Stand-up Meeting
  • body - Email body

Request

POST /systems/emails HTTP/1.1
Authorization: AUTHORIZATION_STRING
Content-Type: application/json
Accept: application/json
{
    "to": "recipient@email.com",
    "subject": "What time is it, where you are?",
    "body": "I miss you more than anything."
}

Response

HTTP/1.1 200 OK
Content-Type: application/json
X-GCore-Version: 0.99
{"message":"Email  successfully sent."}

POST /systems/locks

Creates a lock that expires after a specified number of time. This lock may be used programatically to prevent synchronization scripts from running simultaneously

Body Parameters

  • name - Name of the lock. This should be unique for every synchronization script. Example: products_sync_magento_to_gcore
  • expires_at -Expiration of the lock. Lock expires as to avoid unintentional leaving of locks due to script failure. Optional. Example: 2014-07-08 18:00:00

Request

POST /systems/locks HTTP/1.1
Authorization: AUTHORIZATION_STRING
Content-Type: application/json
Accept: application/json
{
    "name":"products_sync_magento_to_gcore",
    "expires_at":"2014-07-08 18:00:00"
}

Response

HTTP/1.1 200 OK
Content-Type: application/json
X-GCore-Version: 0.99
{"lock_obtained":true}

DELETE /systems/locks/[name]

Delete a lock. This is done when a script that needs exclusive access to a resource has finished.

URL Parameters

  • name - Name of the lock. Example: products_sync_magento_to_gcore

Request

DELETE /systems/locks/products_sync_magento_to_gcore HTTP/1.1
Authorization: AUTHORIZATION_STRING
Content-Type: application/json
Accept: application/json

Response

200 (OK)
Content-Type: application/json
X-GCore-Version: 0.99
{"lock_removed":true}

Clone this wiki locally