How to get SMTP-ID in sendgrid API through json? Example :
In the API tutorial they have mentioned to execute
http(s)://username:password#domain/foo.php
and the result will be (in json):
"email": "john.doe#sendgrid.com",
"timestamp": 1337197600,
"smtp-id": "<4FB4041F.6080505#sendgrid.com>",
"event": "processed"
But actually we need the perfect url to get json.
for eg :
https://sendgrid.com/api/bounces.get.json
for bounce mails
similarly , is there anything to get the above sample json.
Thanks in advance..
If you send an Email to SendGrid through the Web API, you won't have an SMTP-ID. That will be generated by the SendGrid server that translates the API call to an SMTP object. So you're right, the SMTP-ID that comes back in the Event POST isn't helpful.
However, you can add Unique Args to your API call using the x-smtpapi argument in the mail.send call. This will let you define whatever tracking metric(s) you want to the message, and it will all come back on the Event POST.
If you are going to use Unique Args feature, please do remember that they will appear in the most Event notifications but not all of them. Please refer for the details to the sendgrid forum topics which include "missing unique_args" and similar. So, think twice before "building the entire infrastructure" around this feature like some of us did :(
I got my answer .
Actually we can try event API using a callback url, that receives POST request having every details about the email delivered, bounced in json format. Whenever some event is triggered we get a request from Sendgrid. Thats cool.
We can keep these details for further Filtering.
Anyway , thanks jacobmovingfwd
Related
I am using EWS Java API to read and process emails. One such email contains few conversation and a MS Teams meeting information at the end. While reading such an email, the EmailMessage.getBody() returns only the MS Teams meeting information and all the other contents of the email body are ommitted. Sample code below:
EmailMessage message = EmailMessage.bind(service, new ItemId(item.get(nMessagePos).getId().getUniqueId()));
String emailBody = message.getBody().toString()
I tried setting the BodyType property to both HTML and Text and then fetched the body of the email but it still returns only the Meeting invite details.
Is there any specific reason for this and is there a way for me to get the complete email body?
I would try to enable tracing https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-trace-requests-responses-to-troubleshoot-ews-managed-api-applications or look at the actually soap responses your getting it could be a parsing issue at the client side (eg bug in the library). You could also try getting the Mimecontent of the Message instead and then parse back the body from that content. Something like EWSEditor might be useful for trying to diagnose what is going on it will show you what the responses look like and allow you to test mimecontent etc without needing to write any code https://github.com/dseph/EwsEditor/releases.
I am working on ecommerce application which is having backend written in java programming langauge.
Application is having code to listen Woocommerce Webhook events. I logged in Woocommerce site and check Webhook configuration and logs in Woocomerce->Status->logs. Logs are showing 200 status code in response. So, no problem I can see in Woocommerce webhook but my application is not listening any webhook events like order.created, etc.
What I was thinking to test it with any example java source code sothat I can get where is problem.
So, if anyone is having good java source code to test Woocommerce Webhook, Please suggest. If anyone face this problem ever, please share.
Not sure that you are fully aware of what WOO-Webhooks are intended to do.
Basically is send some post data to a specific link and from there it's up to you to do whatever wanted with data.
A simple receiverwith php can be (that you specified at Delivery URL)
<?php
//echo date("l jS \of F Y h:i:s A");
$msg = "woo order \n";
if($_SERVER['REQUEST_METHOD']=="POST")
{
$data = file_get_contents('php://input');
$msg .= strval($data);
}
// send email
mail("yourmail#mail.com","woo order",strval($msg));
//echo date("l jS \of F Y h:i:s A");
Response on mail can be something like:
Instead of processing, data is dumped to mail. It's up to you here to implement any logic since you got the data.
If wanted to process something with another language java then adapt it (do a web-server, externalize the link, process as suitable the data). Same steps as example provided.
On Logs can be found addition information about what was delivered, how ...
What should be the body-text or body-html when doing a POST request using this API to create messages?
API - https://developer.surveymonkey.com/api/v3/#collectors-id-messages
When I am inserting survey link in the body, I am not getting a clickable embedded question in the mail body like we get when using email collector from console.
Building that format is not currently supported in the API, you can only create with a custom HTML.
That said you can copy a previous message that is in the right format through the API. From the link you specified: https://developer.surveymonkey.com/api/v3/#collectors-id-messages
It shows you can set a from collector/message to copy:
POST /v3/collectors/<collector_id>/messages
{
"from_collector_id": "<any_collector_id>",
"from_message_id": "<message_id_from_provided_collector_id>"
}
That will take a copy of a message you already have created as a template and create a new message. Hopefully that could be a good workaround for your use case.
I need to write a HTTP client which to communicate with Floodlight OpenFlow controller via its REST API.
For testing I did it in python, and it worked OK. But now I'm in a situation where it has to be done in Java, of which I'm admittedly still at the beginner's level. One of my apps uses AsyncHttpClient to dispatch async GET requests, and works just fine. Now as a Floodlight's REST client, it has to do POST and DELETE with JSON encoded body. My code for an async POST request works very much as expected.
But no luck with DELETE.
Somehow it doesn't write JSON string into its request body.
The code is almost identical with POST. For debugging, I don't feed an AsyncCompletionHandler instance to execute() method.
System.out.println(ofEntry.toJson()); // this returns {"name": "xyz"} as expected.
Future<Response> f = httpClient.prepareRequest(new RequestBuilder("DELETE")
.setUrl("http://" + myControllerBaseUrl + urlPathFlowPostDelete)
.setHeader("content-type", "application/json")
.setBody(ofEntry.toJson())
.build()).execute();
System.out.println(f.getStatusCode()); // returns 200.
System.out.println(f.getResponseBody()); // returns {"status" : "Error! No data posted."}.
Just to make sure, I peeped into packet dump with wireshark, and found out the server isn't lying :)
The author of the library has written an extensive amount of relevant, valuable information, but unfortunately I can't find example code specifically for building a DELETE request.
I'd very much appreciate any suggestions, pointers, and of course pinpoint solutions!
Not sure that replying to my own question is appropriate here, but I have just found a related thread at the floodlight-dev Google group.
Problem with Static Flow Pusher DELETE REST method
So this could be a problem with Floodlight REST API which requires message body for a DELETE request to identify what to be deleted, whereas AHC is simply compliant with RFC2616.
I will follow the thread at Google group, and see how it will conclude among developers.
All,
I'm trying to find out, unambiguously, what method (GET or POST) Flash/AS2 uses with XML.sendAndLoad.
Here's what the help/docs (http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00002340.html) say about the function
Encodes the specified XML object into
an XML document, sends it to the
specified URL using the POST method,
downloads the server's response, and
loads it into the resultXMLobject
specified in the parameters.
However, I'm using this method to send XML data to a Java Servlet developed and maintained by another team of developers. And they're seeing log entries that look like this:
GET /portal/delegate/[someService]?svc=setPayCheckInfo&XMLStr=[an encoded version of the XML I send]
After a Google search to figure out why the POST shows up as a GET in their log, I found this Adobe technote (http://kb2.adobe.com/cps/159/tn_15908.html). Here's what it says:
When loadVariables or getURL actions are
used to send data to Java servlets it
can appear that the data is being sent
using a GET request, when the POST
method was specified in the Flash
movie.
This happens because Flash sends the
data in a GET/POST hybrid format. If
the data were being sent using a GET
request, the variables would appear in
a query string appended to the end of
the URL. Flash uses a GET server
request, but the Name/Value pairs
containing the variables are sent in a
second transmission using POST.
Although this causes the servlet to
trigger the doGet() method, the
variables are still available in the
server request.
I don't really understand that. What is a "GET/POST hybrid format"?
Why does the method Flash uses (POST or GET) depend on whether the data is sent to a Java servlet or elsewhere (e.g., a PHP page?)
Can anyone make sense of this? Many thanks in advance!
Cheers,
Matt
Have you try doing something like that :
var sendVar=new LoadVars();
var xml=new XML("<r>test</r>");
sendVar.xml=xml;
sendVar.svc="setPayCheckInfo";
var receiveXML=new XML();
function onLoad(success) {
if (success) {
trace("receive:"+receiveXML);
} else {
trace('error');
}
}
receiveXML.onLoad=onLoad;
sendVar.sendAndLoad("http://mywebserver", receiveXML, "POST");
The hybrid format is just a term Macromedia invented to paint over its misuse of HTTP.
HTTP is very vague on what you can do with GET and POST. But the convention is that no message body is used in GET. Adobe violates this convention by sending parameters in the message body.
Flash sends the same request regardless of the server. You have problem in Servlet because most implementation (like Tomcat) ignores message body for GET. PHP doesn't care the verb and it processes the message body for GET too.