LEAF API Documentation

Campaign Subscription POST

Subscribes or removes an email address from this campaign

Parameters

Request Parameters
ParameterNameTypeDescription
EmailAddressEmail AddressStringThe email address for the subscription
ActionActionEnumerationThe action to take for the supplied email address
Response Parameters
ParameterNameTypeDescription
ResultResultEnumerationIf successful, indicates the resulting action carried out for the supplied email address

Enumerations

Action (Request)
ValueDescription
SubscribeSubscribe
RemoveRemove
Result (Response)
ValueDescription
SubscribedAddress was added to the campaign
RemovedAddress was removed from the campaign
AlreadySubscribedAddress was already subscribed to the campaign
NotASubsciberAddress was not subscribed to the campaign so couldn't be removed
ConfirmationNotSentUnable to send subscription confirmation message to the address

XML

Request Schema
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="SubscriptionRequest">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="EmailAddress" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>The email address for the subscription</xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="Action">
          <xsd:annotation>
            <xsd:documentation>The action to take for the supplied email address</xsd:documentation>
          </xsd:annotation>
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:enumeration value="Subscribe" />
              <xsd:enumeration value="Remove" />
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>
Example Request
POST https://api.leaf.eco/r1/campaigns/ebrief.eb HTTP/1.1
Accept: text/xml
Content-Type: text/xml; charset=utf-8

		<?xml version="1.0" encoding="utf-8"?>
<SubscriptionRequest>
  <EmailAddress>xsd:string</EmailAddress>
  <Action>xsd:string</Action>
</SubscriptionRequest>
Response Schema
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="SubscriptionResult">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Result">
          <xsd:annotation>
            <xsd:documentation>If successful, indicates the resulting action carried out for the supplied email address</xsd:documentation>
          </xsd:annotation>
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:enumeration value="Subscribed">
                <xsd:annotation>
                  <xsd:documentation>Address was added to the campaign</xsd:documentation>
                </xsd:annotation>
              </xsd:enumeration>
              <xsd:enumeration value="Removed">
                <xsd:annotation>
                  <xsd:documentation>Address was removed from the campaign</xsd:documentation>
                </xsd:annotation>
              </xsd:enumeration>
              <xsd:enumeration value="AlreadySubscribed">
                <xsd:annotation>
                  <xsd:documentation>Address was already subscribed to the campaign</xsd:documentation>
                </xsd:annotation>
              </xsd:enumeration>
              <xsd:enumeration value="NotASubsciber">
                <xsd:annotation>
                  <xsd:documentation>Address was not subscribed to the campaign so couldn't be removed</xsd:documentation>
                </xsd:annotation>
              </xsd:enumeration>
              <xsd:enumeration value="ConfirmationNotSent">
                <xsd:annotation>
                  <xsd:documentation>Unable to send subscription confirmation message to the address</xsd:documentation>
                </xsd:annotation>
              </xsd:enumeration>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>
Example Response
HTTP/1.1 200 OK
Content-Type: text/xml

<?xml version="1.0" encoding="utf-8"?>
<SubscriptionResult>
  <Result>xsd:string</Result>
</SubscriptionResult>

JSON

Example Request
POST https://api.leaf.eco/r1/campaigns/ebrief.eb HTTP/1.1
Accept: application/json
Content-Type: application/json; charset=utf-8

		{"EmailAddress":String,
  "Action":String}
Example Response
HTTP/1.1 200 OK
Content-Type: application/json

{"Result":String}

Status Codes

Status and Error Codes
HTTP StatusError CodeDescription
200  
400DataError:Action:RequiredRule

An action is required

400DataError:EmailAddress:InvalidFormat 
400DataError:EmailAddress:RequiredRule

An email address is required

403  

Test

The email address for the subscription
The action to take for the supplied email address