This endpoint allows you to add, view, or remove newsletters.
add
Create a new Newsletter.
| Parameter |
Required |
Requirements |
Description |
| identity |
Yes |
Must be an existing Identity |
The Identity that will be used for the Newsletter being created. |
| name |
Yes |
None |
The name that will be used for the Newsletter being created. |
| subject |
Yes |
None |
The subject that will be used for the Newsletter being created. |
| text |
Yes |
None |
The text portion of the Newsletter being created. |
| html |
Yes |
None |
The html portion of the Newsletter being created. |
Call
1
| http://sendgrid.com/api/newsletter/add.json?identity=Sender_Address&name=SendGridv1_(deprecated)NLv1_(deprecated)Test&subject=testsubject&text=testtextbody&html=%3Chtml%3E%3Cp%3Etestv1_(deprecated)htmlv1_(deprecated)body%3C%2Fp%3E%3C%2Fhtml%3E&api_user=SGusername&api_key=SGpassword
|
Response: Success
1
2
3
| {
"message": "success"
}
|
Response: Error
1
2
3
4
5
6
| {
"message": "error",
"errors": [
"...error messages..."
]
}
|
Call
1
| http://sendgrid.com/api/newsletter/add.xml?identity=Sender_Address&name=SendGridv1_(deprecated)NLv1_(deprecated)Test&subject=testsubject&text=testtextbody&html=%3Chtml%3E%3Cp%3Etestv1_(deprecated)htmlv1_(deprecated)body%3C%2Fp%3E%3C%2Fhtml%3E&api_user=SGusername&api_key=SGpassword
|
Response: Success
1
2
3
4
5
| <?xml version="1.0" encoding="ISO-8859-1"?>
<result>
<message>success</message>
</result>
|
Response: Error
1
2
3
4
5
| <?xml version="1.0" encoding="ISO-8859-1"?>
<result>
<message>error: reason</message>
</result>
|
edit
Edit an existing Newsletter.
| Parameter |
Required |
Requirements |
Description |
name |
Yes |
Must be an existing Identity |
The name of the Newsletter being updated. |
| newname |
Yes |
None |
The new name for the Newsletter being edited. |
| identity |
Yes |
Must be an existing Identity |
The new Identity for the Newsletter being edited. |
| subject |
Yes |
None |
The new subject that will be used for the Newsletter being edited. |
| text |
Yes |
None |
The new text portion of the Newsletter being edited. |
| html |
Yes |
None |
The new html portion of the Newsletter being edited. |
Call
1
| http://sendgrid.com/api/newsletter/edit.json?identity=Sender_Address&name=SendGridv1_(deprecated)Editv1_(deprecated)NLv1_(deprecated)Test&newname=newv1_(deprecated)namev1_(deprecated)test&subject=testv1_(deprecated)subject&text=testv1_(deprecated)text&html=%3Chtml%3E%3Cp%3ETestv1_(deprecated)htmlv1_(deprecated)text%3C%2Fp%3E%3C%2Fhtml%3E&api_user=SGusername&api_key=SGpassword
|
Response: Success
1
2
3
| {
"message": "success"
}
|
Response: Error
1
2
3
4
5
6
| {
"message": "error",
"errors": [
"...error messages..."
]
}
|
Call
1
| http://sendgrid.com/api/newsletter/edit.xml?identity=Sender_Address&name=SendGridv1_(deprecated)Editv1_(deprecated)NLv1_(deprecated)Test&newname=newv1_(deprecated)namev1_(deprecated)test&subject=testv1_(deprecated)subject&text=testv1_(deprecated)text&html=%3Chtml%3E%3Cp%3ETestv1_(deprecated)htmlv1_(deprecated)text%3C%2Fp%3E%3C%2Fhtml%3E&api_user=SGusername&api_key=SGpassword
|
Response: Success
1
2
3
4
5
| <?xml version="1.0" encoding="ISO-8859-1"?>
<result>
<message>success</message>
</result>
|
Response: Error
1
2
3
4
5
| <?xml version="1.0" encoding="ISO-8859-1"?>
<result>
<message>error: reason</message>
</result>
|
get
Retrieve the contents of an existing Newsletter.
| Parameter |
Required |
Requirements |
Description |
| name |
Yes |
Must be an existing Newsletter |
Retrieve the content of an existing Newsletter. |
Call
1
| http://sendgrid.com/api/newsletter/get.json?name=SendGridv1_(deprecated)NLv1_(deprecated)Test&api_user=SGusername&api_key=SGpassword
|
Response: Success
1
2
3
4
5
6
7
8
9
10
11
12
| {
"can_edit": true,
"name": "SendGrid NL Test",
"text": null,
"newsletter_id": 38074,
"total_recipients": 1,
"html": null,
"type": "html",
"date_schedule": null,
"identity": "d22de3a53fac1abef944c80c19032c2c",
"subject": null
}
|
Response: Error
1
2
3
4
5
6
| {
"message": "error",
"errors": [
"...error messages..."
]
}
|
Call
1
| http://sendgrid.com/api/newsletter/get.xml?name=SendGridv1_(deprecated)NLv1_(deprecated)Test&api_user=SGusername&api_key=SGpassword
|
Response: Success
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| <?xml version="1.0" encoding="ISO-8859-1"?>
<newsletter>
<can_edit>True</can_edit>
<name>SendGrid NL Test</name>
<text/>
<newsletter_id>38074</newsletter_id>
<total_recipients>1</total_recipients>
<html/>
<type>html</type>
<date_schedule/>
<identity>d22de3a53fac1abef944c80c19032c2c</identity>
<subject/>
</newsletter>
|
Response: Error
1
2
3
4
5
| <?xml version="1.0" encoding="ISO-8859-1"?>
<result>
<message>error: reason</message>
</result>
|
list
Retrieve a list of all existing Newsletter.
| Parameter |
Required |
Requirements |
Description |
| name |
No |
Must be an existing Newsletter |
Search to see if a specific Newsletter exists rather than a list of all Newsletters. |
Call
1
| http://sendgrid.com/api/newsletter/list.json?&api_user=SGusername&api_key=SGpassword
|
Response: Success
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| [
{
"name": "Just Testing",
"newsletter_id": 560308
},
{
"name": "LSRC",
"newsletter_id": 560869
},
{
"name": "LSRC test",
"newsletter_id": 560908
},
{
"name": "Test",
"newsletter_id": 38074
}
]
|
Response: Error
1
2
3
4
5
6
| {
"message": "error",
"errors": [
"...error messages..."
]
}
|
Call
1
| http://sendgrid.com/api/newsletter/list.xml?&api_user=SGusername&api_key=SGpassword
|
Response: Success
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| <?xml version="1.0" encoding="ISO-8859-1"?>
<newsletters>
<newsletter>
<name>Just Testing</name>
<newsletter_id>560308</newsletter_id>
</newsletter>
<newsletter>
<name>LSRC</name>
<newsletter_id>560869</newsletter_id>
</newsletter>
<newsletter>
<name>LSRC test</name>
<newsletter_id>560908</newsletter_id>
</newsletter>
<newsletter>
<name>Test</name>
<newsletter_id>38074</newsletter_id>
</newsletter>
</newsletters>
|
Response: Error
1
2
3
4
5
| <?xml version="1.0" encoding="ISO-8859-1"?>
<result>
<message>error: reason</message>
</result>
|
delete
Remove an existing Newsletter.
| Parameter |
Required |
Requirements |
Description |
| name |
Yes |
Must be an existing Newsletter |
Remove the Newsletter with this name. |
Call
1
| http://sendgrid.com/api/newsletter/delete.json?name=SendGridv1_(deprecated)NLv1_(deprecated)Test1&api_user=Sgusername&api_key=SGpassword
|
Response: Success
1
2
3
| {
"message": "success"
}
|
Response: Error
1
2
3
4
5
6
| {
"message": "error",
"errors": [
"...error messages..."
]
}
|
Call
1
| http://sendgrid.com/api/newsletter/delete.xml?name=SendGridv1_(deprecated)NLv1_(deprecated)Test1&api_user=Sgusername&api_key=SGpassword
|
Response: Success
1
2
3
4
5
| <?xml version="1.0" encoding="ISO-8859-1"?>
<result>
<message>success</message>
</result>
|
Response: Error
1
2
3
4
5
| <?xml version="1.0" encoding="ISO-8859-1"?>
<result>
<message>error: reason</message>
</result>
|