Skip to content

Commit 7e5a98f

Browse files
Merge pull request #490 from sendgrid/request-body
Example request body retrieval
2 parents a112ca8 + e283fe4 commit 7e5a98f

File tree

1 file changed

+55
-43
lines changed

1 file changed

+55
-43
lines changed

TROUBLESHOOTING.md

Lines changed: 55 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,17 @@ If you can't find a solution below, please open an [issue](https://github.com/se
55

66
## Table of Contents
77

8-
* [Migrating from the v2 API to v3](#migrating)
98
* [Continue Using the v2 API](#v2)
9+
* [Environment Variables and Your SendGrid API Key](#environment)
10+
* [Error Messages](#error)
11+
* [Migrating from the v2 API to v3](#migrating)
1012
* [Migrating from the v8 SDK to v9](#sdkmigration)
13+
* [Missing Classes](#missing)
1114
* [Testing v3 /mail/send Calls Directly](#testing)
1215
* [Using .NET 4.5.1 and lower](#net45)
13-
* [Missing Classes](#missing)
14-
* [Error Messages](#error)
15-
* [Versions](#versions)
16-
* [Environment Variables and Your SendGrid API Key](#environment)
1716
* [Using the Package Manager](#package-manager)
18-
19-
<a name="migrating"></a>
20-
## Migrating from the v2 API to v3
21-
22-
Please review [our guide](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/how_to_migrate_from_v2_to_v3_mail_send.html) on how to migrate from v2 to v3.
17+
* [Versioning Convention](#versioning)
18+
* [Viewing the Request Body](#request-body)
2319

2420
<a name="v2"></a>
2521
## Continue Using the v2 API
@@ -36,34 +32,20 @@ Download:
3632

3733
Click the "Clone or download" green button in [GitHub](https://github.com/sendgrid/sendgrid-csharp/tree/b27983a8f3d84a9d28972f2720cca0315ad9fe32) and choose download.
3834

39-
<a name="sdkmigration"></a>
40-
## Migrating from the v8 SDK to v9
41-
42-
v9 of this SDK is a complete rewrite that includes the removal of dynamic dependencies, a new Mail Helper and support for .NET Standard 1.3.
43-
44-
Please begin at the [README](https://github.com/sendgrid/sendgrid-csharp) and if you need further assistance, please [create an issue on GitHub](https://github.com/sendgrid/sendgrid-csharp/issues).
45-
46-
<a name="net45"></a>
47-
## Using .NET 4.5.1 and lower
48-
49-
[Microsoft is no longer supporting these versions](https://blogs.msdn.microsoft.com/dotnet/2015/12/09/support-ending-for-the-net-framework-4-4-5-and-4-5-1/). We strongly advise upgrading your software to target .NET 4.5.2 or higher. If you are unable to do so, the current solution is to download the code directly into your project and change the compile target to the desired version.
50-
51-
<a name="missing"></a>
52-
## Missing Classes
35+
<a name="environment"></a>
36+
## Environment Variables and Your SendGrid API Key
5337

54-
If you receive one of the following errors, or something similar:
38+
All of our examples assume you are using [environment variables](https://github.com/sendgrid/sendgrid-csharp#setup-environment-variables) to hold your SendGrid API key.
5539

56-
* ‘Helpers’ does not exist in the namespace ‘SengrGrid’
57-
* The type or namespace name ‘Mail’ could not be found
40+
If you choose to add your SendGrid API key directly (not recommended):
5841

59-
it means that you are probably not compiling your application to .NET 4.5.2. Currently, this is the only supported version of .NET by SendGrid.
42+
`string apiKey = Environment.GetEnvironmentVariable("SENDGRID_API_KEY");`
6043

61-
The current solution is to download the code directly into your project and change the compile target to the desired version.
44+
becomes
6245

63-
<a name="testing"></a>
64-
## Testing v3 /mail/send Calls Directly
46+
`string apiKey = "SENDGRID_API_KEY";`
6547

66-
[Here](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/curl_examples.html) are some cURL examples for common use cases.
48+
In the first case SENDGRID_API_KEY is in reference to the name of the environment variable, while the second case references the actual SendGrid API Key.
6749

6850
<a name="error"></a>
6951
## Error Messages
@@ -79,25 +61,39 @@ Console.WriteLine(response.Body.ReadAsStringAsync().Result); // The message will
7961
Console.WriteLine(response.Headers.ToString());
8062
```
8163

82-
<a name="versions"></a>
83-
## Versions
64+
<a name="migrating"></a>
65+
## Migrating from the v2 API to v3
8466

85-
We follow the MAJOR.MINOR.PATCH versioning scheme as described by [SemVer.org](http://semver.org). Therefore, we recommend that you always pin (or vendor) the particular version you are working with to your code and never auto-update to the latest version. Especially when there is a MAJOR point release, since that is guarenteed to be a breaking change. Changes are documented in the [CHANGELOG](https://github.com/sendgrid/sendgrid-csharp/blob/master/CHANGELOG.md) and [releases](https://github.com/sendgrid/sendgrid-csharp/releases) section.
67+
Please review [our guide](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/how_to_migrate_from_v2_to_v3_mail_send.html) on how to migrate from v2 to v3.
8668

87-
<a name="environment"></a>
88-
## Environment Variables and Your SendGrid API Key
69+
<a name="sdkmigration"></a>
70+
## Migrating from the v8 SDK to v9
8971

90-
All of our examples assume you are using [environment variables](https://github.com/sendgrid/sendgrid-csharp#setup-environment-variables) to hold your SendGrid API key.
72+
v9 of this SDK is a complete rewrite that includes the removal of dynamic dependencies, a new Mail Helper and support for .NET Standard 1.3.
9173

92-
If you choose to add your SendGrid API key directly (not recommended):
74+
Please begin at the [README](https://github.com/sendgrid/sendgrid-csharp) and if you need further assistance, please [create an issue on GitHub](https://github.com/sendgrid/sendgrid-csharp/issues).
9375

94-
`string apiKey = Environment.GetEnvironmentVariable("SENDGRID_API_KEY");`
76+
<a name="missing"></a>
77+
## Missing Classes
9578

96-
becomes
79+
If you receive one of the following errors, or something similar:
9780

98-
`string apiKey = "SENDGRID_API_KEY";`
81+
* ‘Helpers’ does not exist in the namespace ‘SengrGrid’
82+
* The type or namespace name ‘Mail’ could not be found
9983

100-
In the first case SENDGRID_API_KEY is in reference to the name of the environment variable, while the second case references the actual SendGrid API Key.
84+
it means that you are probably not compiling your application to .NET 4.5.2. Currently, this is the only supported version of .NET by SendGrid.
85+
86+
The current solution is to download the code directly into your project and change the compile target to the desired version.
87+
88+
<a name="testing"></a>
89+
## Testing v3 /mail/send Calls Directly
90+
91+
[Here](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/curl_examples.html) are some cURL examples for common use cases.
92+
93+
<a name="net45"></a>
94+
## Using .NET 4.5.1 and lower
95+
96+
[Microsoft is no longer supporting these versions](https://blogs.msdn.microsoft.com/dotnet/2015/12/09/support-ending-for-the-net-framework-4-4-5-and-4-5-1/). We strongly advise upgrading your software to target .NET 4.5.2 or higher. If you are unable to do so, the current solution is to download the code directly into your project and change the compile target to the desired version.
10197

10298
<a name="package-manager"></a>
10399
## Using the Package Manager
@@ -107,3 +103,19 @@ We upload this library to [Nuget](https://www.nuget.org/packages/SendGrid) whene
107103
In most cases we recommend you download the latest version of the library, but if you need a different version, please use:
108104

109105
`PM> Install-Package Sendgrid -Version X.X.X`
106+
107+
<a name="versioning"></a>
108+
## Versioning Convention
109+
110+
We follow the MAJOR.MINOR.PATCH versioning scheme as described by [SemVer.org](http://semver.org). Therefore, we recommend that you always pin (or vendor) the particular version you are working with to your code and never auto-update to the latest version. Especially when there is a MAJOR point release, since that is guarenteed to be a breaking change. Changes are documented in the [CHANGELOG](https://github.com/sendgrid/sendgrid-csharp/blob/master/CHANGELOG.md) and [releases](https://github.com/sendgrid/sendgrid-csharp/releases) section.
111+
112+
<a name="request-body"></a>
113+
## Viewing the Request Body
114+
115+
When debugging or testing, it may be useful to exampine the raw request body to compare against the [documented format](https://sendgrid.com/docs/API_Reference/api_v3.html).
116+
117+
You can do this right before you call `var response = await client.SendEmailAsync(msg);` like so:
118+
119+
```csharp
120+
Console.WriteLine(msg.Serialize());
121+
```

0 commit comments

Comments
 (0)