Relay Servers API
- Table of Contents
- Overview
- Attributes
- Get a list of Relay Servers
- Get all Details About a Single Relay Server
- Create a Relay Server
- Update a Relay Server
- Delete a Relay Server
Overview
Relay Servers are VirtualMTAs that enable GreenArrow Engine to function as an SMTP client. They can be used to inject messages into both GreenArrow and non-GreenArrow SMTP servers.
Attributes
The following attributes are defined for Relay Servers:
| relay_server hash/ required 
 | |||||||||||||||||||||||||||||||||||
Get a list of Relay Servers
GET /ga/api/v3/eng/relay_servers
GET /ga/api/v3/eng/relay_servers?page={page}
GET /ga/api/v3/eng/relay_servers?page_token={page_token}
Parameters
| page integer/ optional | The page number to retrieve. Page numbering starts at  | 
| page_token string/ optional | The  | 
Response
The response will contain a list of Relay Servers in the following format.
| relay_servers array of hashes 
 | |||||||||||
| pagination hash 
 | |||||||||||
Example
GET /ga/api/v3/eng/relay_servers
HTTP/1.1 200 OK
{
  "success": true,
  "data": {
    "relay_servers": [
      {
        "id": 4,
        "name": "relay-1"
      },
      {
        "id": 5,
        "name": "relay-2"
      },
      {
        "id": 6,
        "name": "relay-3"
      }
    ],
    "pagination": {
      "page": 0,
      "per_page": 100,
      "num_pages": 1,
      "num_records": 3,
      "next_page_token": null
    }
  },
  "error_code": null,
  "error_messages": null
}
Get all Details About a Single Relay Server
GET /ga/api/v3/eng/relay_servers/{id}
Response
| relay_server hash | The attributes for this hash are defined in the Attributes section of this document. | 
Example
GET /ga/api/v3/eng/relay_servers/16
HTTP/1.1 200 OK
{
  "success": true,
  "data": {
    "relay_server": {
      "id": 16,
      "name": "relay-1",
      "source_ip": {
        "ip": "127.0.0.2",
        "hostname": "outgoing-hostname.com"
      },
      "destination": {
        "hostname": "destination-hostname.com",
        "port": 26,
        "username": "myusername",
        "password": "mysecret"
      },
      "throttle_limits": {
        "max_concurrent_connections": 2,
        "max_messages_per_hour": 120
      },
      "redirect": null
    }
  },
  "error_code": null,
  "error_messages": null
}
Create a Relay Server
POST /ga/api/v3/eng/relay_servers
Payload
The JSON data sent to this endpoint should contain an object as described in the Attributes section of this page.
The data may contain a mixture of required and optional fields. Do not specify read-only fields.
Response
The response will include a relay_server key containing the full Relay Server
record as defined in Relay Server Attributes.
Example
POST /ga/api/v3/eng/relay_servers
{
  "relay_server": {
    "name": "new-relay-server",
    "source_ip": {
      "ip": "127.0.0.2",
      "hostname": "outgoing-hostname.com"
    },
    "destination": {
      "hostname": "destination-hostname.com",
      "port": 25,
      "username": "myusername",
      "password": "mysecret"
    },
    "throttle_limits": {
      "max_concurrent_connections": 2,
      "max_messages_per_hour": 120
    },
    "redirect": {
      "name": "ipaddr-1"
    }
  }
}
HTTP/1.1 200 OK
{
  "success": true,
  "data": {
    "relay_server": {
      "id": 26,
      "name": "new-relay-server",
      "source_ip": {
        "ip": "127.0.0.2",
        "hostname": "outgoing-hostname.com"
      },
      "destination": {
        "hostname": "destination-hostname.com",
        "port": 25,
        "username": "myusername",
        "password": "mysecret"
      },
      "throttle_limits": {
        "max_concurrent_connections": 2,
        "max_messages_per_hour": 120
      },
      "redirect": {
        "type": "ip_address",
        "id": 20,
        "name": "ipaddr-1"
      }
    }
  },
  "error_code": null,
  "error_messages": null
}
Update a Relay Server
PUT /ga/api/v3/eng/relay_servers/{id}
Payload
| relay_server hash | The JSON data sent to this endpoint should contain an object as described in the Attributes section of this page. The data may contain a mixture of required and optional fields. Do not specify read-only fields. | 
Response
The response will include a relay_server key containing the full Relay Server
record as defined in Relay Server Attributes.
Example
PUT /ga/api/v3/eng/relay_servers/29
{
  "relay_server": {
    "name": "updated-relay-server",
    "source_ip": {
      "ip": "127.0.0.7",
      "hostname": "updated-outgoing-hostname.com"
    },
    "destination": {
      "hostname": "updated-destination-hostname.com",
      "port": 1025,
      "username": "updated-myusername",
      "password": "updated-mysecret"
    },
    "throttle_limits": {
      "max_concurrent_connections": 5,
      "max_messages_per_hour": 500
    },
    "redirect": null
  }
}
HTTP/1.1 200 OK
{
  "success": true,
  "data": {
    "relay_server": {
      "id": 29,
      "name": "updated-relay-server",
      "source_ip": {
        "ip": "127.0.0.7",
        "hostname": "updated-outgoing-hostname.com"
      },
      "destination": {
        "hostname": "updated-destination-hostname.com",
        "port": 1025,
        "username": "updated-myusername",
        "password": "updated-mysecret"
      },
      "throttle_limits": {
        "max_concurrent_connections": 5,
        "max_messages_per_hour": 500
      },
      "redirect": null
    }
  },
  "error_code": null,
  "error_messages": null
}
Delete a Relay Server
DELETE /ga/api/v3/eng/relay_servers/{id}
Relay Servers that are currently used by other records may not be deleted. Use the VirtualMTAs API to get a list of such records.
References made to Relay Servers from GreenArrow Studio will not prevent deletion of the Relay Server, but may in the future. Deleting a Relay Server that is used in GreenArrow Studio by a scheduled/in-progress campaign will cause the campaign to either not send or send with the Default Virtual MTA.
Response
The response is a standard success or error response.
Example
DELETE /ga/api/v3/eng/relay_servers/41
HTTP/1.1 200 OK
{
  "success": true,
  "data": {
  },
  "error_code": null,
  "error_messages": null
}
