Subscription forms

List of forms you can use to subscribe user to your newsletter(s).


Renders: [application/json, text/html, application/xml]

Parses: [application/json, application/x-www-form-urlencoded, multipart/form-data]


Required fields

  • name
  • lists
  • verify_mail_subject
  • verify_mail_text
  • sender_id

Optional fields

  • next_url
  • button_text
  • first_name
  • last_name
  • sms_number
  • attributes
  • sender
  • email_label
  • first_name_label
  • last_name_label
  • success_text
  • invalid_email_text

Readonly fields

  • url
  • key
  • lists_names
  • form
  • form_link
  • email
  • unconfirmed_subscribers

Example subscription form

{
    "url": "http://api.getanewsletter.com/v3/subscription_forms/Ml8ScUfjTP/",
    "key": "Ml8ScUfjTP",
    "name": "form-12",
    "lists": [
        "ZKHwZ"
    ],
    "lists_names": "List_34029",
    "next_url": null,
    "button_text": null,
    "first_name": true,
    "last_name": true,
    "attributes": [
        "attributename23",
        "attributename24",
        "attributename25"
    ],
    "form": "<form action=\"http://gansub.com/s/odsk4j4398b/\">\n    <input type=\"hidden\" name=\"newsletter\" value=\"ZKHwZ\" id=\"id_newsletter\" />\n    <input type=\"hidden\" name=\"next_url\" id=\"id_next_url\" value=\"http://example.com/next_url/\"/>\n    <input type=\"hidden\" name=\"api_key\" value=\"Ml8ScUfjTP\" id=\"id_api_key\" />\n\n    <label for=\"email\">Email</label>\n    <input type=\"text\" id=\"email\" name=\"email\" />\n    \n<label for=\"email\">First name</label>\n<input type=\"text\" id=\"first_name\" name=\"first_name\" />\n        \n    \n<label for=\"email\">Last name</label>\n<input type=\"text\" id=\"last_name\" name=\"last_name\" />\n        \n    \n<label for=\"email\">AttributeName23</label>\n<input type=\"text\" id=\"attributename23\" name=\"attributename23\" />\n        \n\n<label for=\"email\">AttributeName24</label>\n<input type=\"text\" id=\"attributename24\" name=\"attributename24\" />\n        \n\n<label for=\"email\">AttributeName25</label>\n<input type=\"text\" id=\"attributename25\" name=\"attributename25\" />\n        \n    <input type=\"submit\" value=\"None\" />\n</form>",
    "form_link": "http://gansub.com/s/odsk4j4398b/",
    "verify_mail_subject": "",
    "verify_mail_text": "",
    "sender": "",
    "email": ""
}

GET /subscription_forms/

Responds with a list of subscription forms, like usual we provide next, prev, count and the results

Possible url parameters are:

  • page: <int>

Example:

{
    "count": 6,
    "next": null,
    "previous": null,
    "results": [
        {
            "url": "http://api.getanewsletter.com/v3/subscription_forms/Ml8ScUfjTP/",
            "key": "Ml8ScUfjTP",
            "name": "form-12",
            "lists": [
                "ZKHwZ"
            ],
            "lists_names": "List_34029",
            "next_url": null,
            "button_text": null,
            "first_name": true,
            "last_name": true,
            "attributes": [
                "attributename23",
                "attributename24",
                "attributename25"
            ],
            "form": "<form action=\"http://gansub.com/s/odsk4j4398b/\">\n    <input type=\"hidden\" name=\"newsletter\" value=\"ZKHwZ\" id=\"id_newsletter\" />\n    <input type=\"hidden\" name=\"next_url\" id=\"id_next_url\" value=\"http://example.com/next_url/\"/>\n    <input type=\"hidden\" name=\"api_key\" value=\"Ml8ScUfjTP\" id=\"id_api_key\" />\n\n    <label for=\"email\">Email</label>\n    <input type=\"text\" id=\"email\" name=\"email\" />\n    \n<label for=\"email\">First name</label>\n<input type=\"text\" id=\"first_name\" name=\"first_name\" />\n        \n    \n<label for=\"email\">Last name</label>\n<input type=\"text\" id=\"last_name\" name=\"last_name\" />\n        \n    \n<label for=\"email\">AttributeName23</label>\n<input type=\"text\" id=\"attributename23\" name=\"attributename23\" />\n        \n\n<label for=\"email\">AttributeName24</label>\n<input type=\"text\" id=\"attributename24\" name=\"attributename24\" />\n        \n\n<label for=\"email\">AttributeName25</label>\n<input type=\"text\" id=\"attributename25\" name=\"attributename25\" />\n        \n    <input type=\"submit\" value=\"None\" />\n</form>",
            "form_link": "http://gansub.com/s/odsk4j4398b/",
            "verify_mail_subject": "",
            "verify_mail_text": "",
            "sender": "",
            "email": ""
        },
        ...
}

POST /subscription_forms/

Creates a new subscription forms.

Example:

POST /subscription_forms/
{
    "name": "Form name",
    "lists": ["ZKHwZ"],
    "attributes": [],
    "sender": "Sender name",
    "email": "john_doe@example.com"
}

Response
{
    "url": "http://api.getanewsletter.com/v3/subscription_forms/kRctg7ko1AcCnZSPO89/",
    "key": "kRctg7ko1AcCnZSPO89",
    "name": "Form name",
    "lists": [
        "ZKHwZ"
    ],
    "lists_names": "List_34029",
    "next_url": null,
    "button_text": null,
    "first_name": false,
    "last_name": false,
    "attributes": [],
    "form": "<form action=\"http://gansub.com/s/odsk4j4398b/\">\n    <input type=\"hidden\" name=\"newsletter\" value=\"ZKHwZ\" id=\"id_newsletter\" />\n    <input type=\"hidden\" name=\"next_url\" id=\"id_next_url\" value=\"http://example.com/next_url/\"/>\n    <input type=\"hidden\" name=\"api_key\" value=\"kRctg7ko1AcCnZSPO89\" id=\"id_api_key\" />\n\n    <label for=\"email\">Email</label>\n    <input type=\"text\" id=\"email\" name=\"email\" />\n    \n    \n    \n    <input type=\"submit\" value=\"None\" />\n</form>",
    "form_link": "http://gansub.com/s/odsk4j4398b/",
    "verify_mail_subject": "",
    "verify_mail_text": "",
    "sender": "Sender name",
    "email": "john_doe@example.com"
}
Location: http://api.getanewsletter.com/v3/subscription_forms/kRctg7ko1AcCnZSPO89/

PUT /subscription_forms/<form_hash>/

Update or create a subscription form.

Status code is 200 if the attribute is updated and 201 if it's created

Example:

PUT /subscription_forms/kRctg7ko1AcCnZSPO89/
{
    "name": "Form name",
    "lists": ["ZKHwZ"],
    "attributes": [],
    "sender": "Sender name",
    "email": "john_doe@example.com"
}

Response
{
    "url": "http://api.getanewsletter.com/v3/subscription_forms/kRctg7ko1AcCnZSPO89/",
    "key": "kRctg7ko1AcCnZSPO89",
    "name": "Form name",
    "lists": [
        "ZKHwZ"
    ],
    "lists_names": "List_34029",
    "next_url": null,
    "button_text": null,
    "first_name": false,
    "last_name": false,
    "attributes": [],
    "form": "<form action=\"http://gansub.com/s/odsk4j4398b/\">\n    <input type=\"hidden\" name=\"newsletter\" value=\"ZKHwZ\" id=\"id_newsletter\" />\n    <input type=\"hidden\" name=\"next_url\" id=\"id_next_url\" value=\"http://example.com/next_url/\"/>\n    <input type=\"hidden\" name=\"api_key\" value=\"kRctg7ko1AcCnZSPO89\" id=\"id_api_key\" />\n\n    <label for=\"email\">Email</label>\n    <input type=\"text\" id=\"email\" name=\"email\" />\n    \n    \n    \n    <input type=\"submit\" value=\"None\" />\n</form>",
    "form_link": "http://gansub.com/s/odsk4j4398b/",
    "verify_mail_subject": "",
    "verify_mail_text": "",
    "sender": "Sender name",
    "email": "john_doe@example.com"
},
201 Created
200 Updated

PATCH /subscription_forms/<form_hash>/

Patch is used for partial updates.


DELETE /subscription_forms/<form_hash>/

Removes the subscription form.

Example:

DELETE /subscription_forms/kRctg7ko1AcCnZSPO89/

Response
Status 204 No Content