Reputation: 138
I'm using SoftLayer API SoftLayer_Network_Message_Delivery_Email_Sendgrid
to send emails to my Slack Channel.
I'm getting API Response Code 500 from quiet sometime. I'm posting the error message I got below
{"error":"Maximum credits exceeded","code":"SoftLayer_Exception_Network_Message_Delivery_Email_Sendgrid_Api_Error"}500
The Code I'm using to sendEmail is as follows:
curl -w %{http_code} -v -H "Content-Type: application/json" -d '{"parameters": [{ "body": "body","containsHtml": false,"from": "[email protected]","subject": "Problem with system backup!", "to": "<EmailID/Slack ID>"}]}' 'https://<username>:<API Key>@api.service.softlayer.com/rest/v3/SoftLayer_Network_Message_Delivery_Email_Sendgrid/57084/sendEmail.json'
Also I wanted to understand what is 57084 in the URL above
Upvotes: 2
Views: 2459
Reputation: 728
The 57084 data is the Email Delivery ID, that was generated by default when a new email delivery was created in your account.
This ID is the SoftLayer_Network_Message_Delivery_Email_SendgridInitParameters that is sending in the Required headers of the request.
For more information you can see the following documentation: https://softlayer.github.io/reference/services/SoftLayer_Network_Message_Delivery_Email_Sendgrid/sendEmail/
To get the email delivery ids associated to your SL account you can use this curl example:
curl -k "https://[username]:[apiKey]@api.softlayer.com/rest/v3/SoftLayer_Account/getNetworkMessageDeliveryAccounts.json" | python -mjson.tool
You will get a response like below:
[
{
"accountId": 111111,
"createDate": "2015-10-23T10:25:12-06:00",
"id": 57084,
"modifyDate": null,
"password": "sdfsdfsd",
"typeId": 21,
"username": "[email protected]",
"vendorId": 1,
"emailAddress": "[email protected]",
"smtpAccess": "1"
}
]
The error you got is because you do not have enough credit in your SendGrid account.
To get your credit account you can use this curl example. The information came directly from SendGrid server:
curl -k "https://[username]:[apiKey]@api.softlayer.com/rest/v3/SoftLayer_Network_Message_Delivery_Email_Sendgrid/57084/getAccountOverview.json" | python -mjson.tool
If you want to get more information about your SendGrid account and your credit you can visit its page.
To get the URL of your account of SendGrid you can use this curl command:
curl -k "https://[username]:[apiKey]@api.softlayer.com/rest/v3/SoftLayer_Network_Message_Delivery_Email_Sendgrid/57084/getVendorPortalUrl.json" | python -mjson.tool
Upvotes: 1