To use the sendEmail method, it is necessary to specify a init parameters (SoftLayer_Network_Message_Delivery_Email_SendgridInitParameters) you can see this in "Required Headers" section from the SoftLayer_Network_Message_Delivery_Email_Sendgrid::sendEmail method, you can get more information about init parameters here.
So, You can get "SoftLayer_Network_Message_Delivery_Email_Sendgrid" objects using the following method: SoftLayer_Account::getNetworkMessageDeliveryAccounts, here a Rest request:
https://$username:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Account/getNetworkMessageDeliveryAccounts
Method: Get
You will get a result like this:
0: {
"accountId": 123456
"createDate": "2015-05-15T06:35:56+12:00"
"id": 24564
"modifyDate": "2016-01-08T05:59:57+11:00"
"password": "Password123*"
"typeId": 21
"username": "newemail@softlayer.com"
"vendorId": 1
"emailAddress": "email@softlayer.com"
"smtpAccess": "1"
}
So, you need to specify the "id" in the service that you are using (SoftLayer_Network_Message_Delivery_Email_Sendgrid). It should look like this in java:
Long sendGridId = new Long(24564);
Sendgrid.Service sendgridService = Sendgrid.service(client, sendGridId);
It doesn't work fine for me, it seems the SoftLayer API Client for Java has an issue to specify init parameters for "SoftLayer_Network_Message_Delivery_Email_Sendgrid" service. You can verify it and submit an issue if you are not able to specify this SoftLayer API Client for Java Issues.
In fact, I can provide a rest request which is working fine:
https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Network_Message_Delivery_Email_Sendgrid/24564/sendEmail
Method: Post
{
"parameters":[
{
"body":"set me",
"from":"set me",
"to":"set me",
"subject":"set me"
}
]
}
References:
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Message_Delivery_Email_Sendgrid/sendEmail