Setting Reply-to in mailgun - mailgun

I've seen the API for this which suggests adding the Reply-To header or h:Reply-To param. I don't have any experience with headers so that may be why I'm having trouble with this.
I'm trying to construct the request in postman, and I've tried putting Reply-To as a header key and an email as the value, and I've also tried without that header and instead with a param with the key h:Reply-To but when I hit "reply" to the email that gets sent, it always replies to the sender instead of my reply-to address.
Can anyone help me?
as header
POST /v3/sandboxXXXXba.mailgun.org/messages?from=messages#xxxx.com& to=xxxx1#gmail.com& subject=hello& text=mailgun-test HTTP/1.1
Host: api.mailgun.net
Reply-To: xxxx2#gmail.com
Authorization: Basic xxxx
cache-control: no-cache
Postman-Token: xxxxx
as param
POST https://api.mailgun.net/v3/sandboxXXXX.mailgun.org/messages?from=messages#domain.com&to=me#gmail.com&subject=hello&text=mailgun-test&h:Reply-To=me#gmail.com
aka:
POST /v3/sandboxXXXXX33ba.mailgun.org/messages?from=messages#mydomain.com& to=myaddress#gmail.com& subject=hello& text=mailgun-test& h:Reply-To=myaddress#gmail.com HTTP/1.1
Host: api.mailgun.net
Authorization: Basic xxxxx
User-Agent: PostmanRuntime/7.15.2
Accept: */*
Cache-Control: no-cache
Postman-Token: xxxx
Host: api.mailgun.net
Accept-Encoding: gzip, deflate
Content-Length:
Connection: keep-alive
cache-control: no-cache

So it should be a form-data body parameter:
POST /v3/skedda.co/messages HTTP/1.1
Host: api.mailgun.net
Authorization: Basic YX...
User-Agent: PostmanRuntime/7.15.2
Accept: */*
Cache-Control: no-cache
Postman-Token: ...
Host: api.mailgun.net
Accept-Encoding: gzip, deflate
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Length: 781
Connection: keep-alive
cache-control: no-cache
Content-Disposition: form-data; name="from"
postmaster#...com
------WebKitFormBoundary7MA4YWxkTrZu0gW--,
Content-Disposition: form-data; name="to"
a....com
------WebKitFormBoundary7MA4YWxkTrZu0gW--,
Content-Disposition: form-data; name="subject"
link test
------WebKitFormBoundary7MA4YWxkTrZu0gW--,
Content-Disposition: form-data; name="html"
<h1>Hello world</h1>
------WebKitFormBoundary7MA4YWxkTrZu0gW--,
Content-Disposition: form-data; name="h:Reply-To"
notifications#...com
------WebKitFormBoundary7MA4YWxkTrZu0gW--
or in Postman itself

Related

FitBit Subscriptions API: create subscription endpoint returns "Error: read ECONNRESET"

I am trying to create a subscription by sending the following request:
POST https://api.fitbit.com/1/user/-/activities/apiSubscriptions/1.json
But I keep getting the following error:
Error: read ECONNRESET
Network
Request Headers
content-length: 10000000
X-Fitbit-Subscriber-Id: fitbit-subscription-handler
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIyMzk5WUQiLCJzdWIiOiI4UTJLOFYiLCJpc3MiOiJGaXRiaXQiLCJ0eXAiOiJhY2Nlc3NfdG9rZW4iLCJzY29wZXMiOiJyZWNnIHJzZXQgcm94eSBybnV0IHJwcm8gcnNsZSByY2YgcmFjdCBycmVzIHJ3ZWkgcmhyIHJ0ZW0iLCJleHAiOjE2NzU0MTgxMzYsImlhdCI6MTY3NTM4OTMzNn0.-_307-4K00hU9fdcN86G0GcONpIYMmyxr8co5dZdaHE
User-Agent: PostmanRuntime/7.30.0
Accept: */*
Cache-Control: no-cache
Postman-Token: d3f2cf54-8d4c-4d81-92e0-5cc2608b5bdb
Host: api.fitbit.com
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
According to Fitbit's official documentation, the content-length header is required as shown in the image:
Simply removing this required header fixes the issue.

Content-Ids not showing up in batch response

The Content-Ids I've setup in my odata batch request payload body are not showing up in the response payload body. Does anyone know what I am doing wrong or missing? I am using postman to test. I am not sure if that is a factor in this.
Sample Request:
--b2ef9c16-0c1f-47b4-942e-c5edd372bcc2
Content-Type: multipart/mixed;boundary=4df12e8f-048c-44f4-8003-1724637652e3
--4df12e8f-048c-44f4-8003-1724637652e3
Content-Type: application/http
Content-Transfer-Encoding:binary
Content-Id: 1
POST CreateChangeRequest HTTP/1.1
Accept:application/json;odata.metadata=full;IEEE754Compatible=true
Content-Type: application/json;IEEE754Compatible=true
{"Init":true}
--4df12e8f-048c-44f4-8003-1724637652e3
Content-Type: application/http
Content-Transfer-Encoding:binary
Content-Id: 2
POST CustomerOrderSet(OrderNo='Z10068')/OrderLinesArray HTTP/1.1
Accept:application/json;odata.metadata=full;IEEE754Compatible=true
Content-Type: application/json;IEEE754Compatible=true
X-IFS-Accept-Warnings: true
{}
--4df12e8f-048c-44f4-8003-1724637652e3
Content-Type: application/http
Content-Transfer-Encoding:binary
Content-Id: 3
POST CreateChangeRequest HTTP/1.1
Accept:application/json;odata.metadata=full;IEEE754Compatible=true
Content-Type: application/json;IEEE754Compatible=true
{"Init":false}
--4df12e8f-048c-44f4-8003-1724637652e3--
--b2ef9c16-0c1f-47b4-942e-c5edd372bcc2--
Sample Response:
--batch_8c97ad06-3e3d-4ac5-9921-7137bb31bdb1
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 204 No Content
OData-Version: 4.0
Content-Length: 0
Content-Language: en-US
Content-Length: 0
--batch_8c97ad06-3e3d-4ac5-9921-7137bb31bdb1
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 500 Internal Server Error
OData-Version: 4.0
Content-Type: application/json
Content-Length: 208
{}
--batch_8c97ad06-3e3d-4ac5-9921-7137bb31bdb1
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 204 No Content
OData-Version: 4.0
Content-Length: 0
Content-Language: en-US
Content-Length: 0
--batch_8c97ad06-3e3d-4ac5-9921-7137bb31bdb1--
Thanks again for your help!

Axis Fault after request from SoapUI

I am sending a request from SoapUI and I am getting an error in return.
I have no idea how to resolve this.
Request:
POST http://localhost:8080/services/ApiService/ HTTP/1.1
Accept-Encoding: gzip,deflate
SOAPAction: ""
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Length: 345
Host: localhost:8080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Response:
HTTP/1.1 500 Server Error
Set-Cookie: EZSESSIONID=y4k1kp87msmg5ni4migdd65f;Path=/
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_89EA7A7AB1A241D9571457445576391; type="application/xop+xml"; start="<0.urn:uuid:89EA7A7AB1A241D9571457445576392#apache.org>"; start-info="text/xml"
Transfer-Encoding: chunked
Server: Jetty(7.6.3.v20120416)
--MIMEBoundaryurn_uuid_89EA7A7AB1A241D9571457445576391
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.urn:uuid:89EA7A7AB1A241D9571457445576392#apache.org>
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server</faultcode><faultstring>org.apache.axiom.om.impl.llom.OMTextImpl cannot be cast to org.apache.axiom.om.OMElement</faultstring><detail /></soapenv:Fault></soapenv:Body></soapenv:Envelope>
--MIMEBoundaryurn_uuid_89EA7A7AB1A241D9571457445576391--
ServerLog:
ERROR 2016-03-08 19:29:36.133 AxisEngine [request-19]
org.apache.axiom.om.impl.llom.OMTextImpl cannot be cast to
org.apache.axiom.om.OMElement org.apache.axis2.AxisFault:
org.apache.axiom.om.impl.llom.OMTextImpl cannot be cast to
org.apache.axiom.om.OMElement at
org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
~[axis2-kernel-1.4.1.jar:na]

Request to web service with Basic authorization via proxy with NTLM authorization not working

I have a web service that requires basic authorisation and a user behind an internet proxy that requires NTLM authorisation. I also have a forms application that makes calls to the web service and also asks the user for the web service credentials (which are different from the NTLM credentials).
I got the app configuration working (WCF ServiceModel), it's using the default proxy credentials, the request is authenticating with the proxy, but after it authenticates with the web service it does not send the request body for some reason.
The process works if I test locally without the NTLM proxy. Sorry about the long examples, but I had to include them.
1st request:
Send:
POST http://www.myservice.com/service.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://tempuri.org/MyMethod"
Host: www.myservice.com
Content-Length: 329
Expect: 100-continue
Accept-Encoding: gzip, deflate
Proxy-Connection: Keep-Alive
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body>[...]</s:Body></s:Envelope>
Receive:
HTTP/1.1 407 Proxy Authentication Required
Proxy-Authenticate: NTLM
Proxy-Authenticate: BASIC realm="corporaterealm"
Cache-Control: no-cache
Pragma: no-cache
Content-Type: text/html; charset=utf-8
Proxy-Connection: close
Set-Cookie: BCSI-CS-36204A5A7BBD24D9=2; Path=/
Connection: close
Content-Length: 1057
Proxy-Support: Session-Based-Authentication
[...]
2nd request:
Send:
POST http://www.myservice.com/service.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://tempuri.org/MyMethod"
Accept-Encoding: gzip, deflate,gzip, deflate
Proxy-Authorization: NTLM TlRMTVNTUAABAAAAB7IIoggACAAxAAAACQAJACgAAAAFASgKAAAAD1dTUkswNDg3MENPTUVUTkVU
Host: www.myservice.com
Content-Length: 0
Receive:
HTTP/1.1 407 Proxy Authentication Required
Proxy-Authenticate: NTLM TlRMTVNTUAACAAAAEAAQADgAAAAFgomiysOwieqrhFEAAAAAAAAAALIAsgBIAAAABQLODgAAAA9DAE8ATQBFAFQATgBFAFQAAgAQAEMATwBNAEUAVABOAEUAVAABABoAVgBJAC0AUgBJAEMASwBEAEMALQAwADAAMQAEABwAYwBvAG0AZQB0AG4AZQB0AC4AbABvAGMAYQBsAAMAOABWAEkALQBSAEkAQwBLAEQAQwAtADAAMAAxAC4AYwBvAG0AZQB0AG4AZQB0AC4AbABvAGMAYQBsAAUAHABjAG8AbQBlAHQAbgBlAHQALgBsAG8AYwBhAGwAAAAAAA==
Cache-Control: no-cache
Pragma: no-cache
Content-Type: text/html; charset=utf-8
Proxy-Connection: Keep-Alive
Set-Cookie: BCSI-CS-36204A5A7BBD24D9=2; Path=/
Connection: Keep-Alive
Content-Length: 1074
Proxy-Support: Session-Based-Authentication
[...]
3rd request:
Send:
POST http://www.myservice.com/service.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://tempuri.org/MyMethod"
Accept-Encoding: gzip, deflate,gzip, deflate,gzip, deflate
Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAHgAAAAYABgAkAAAABAAEABIAAAADgAOAFgAAAASABIAZgAAAAAAAACoAAAABYKIogUBKAoAAAAPQwBPAE0ARQBUAE4ARQBUAFAAYQByAHMAbwBuAEoAVwBTAFIASwAwADQAOAA3ADAAlap7g+mPRMEAAAAAAAAAAAAAAAAAAAAARLAhi5lf3nd+l9xENAcu2W6xf6iJbyM6
Host: www.myservice.com
Content-Length: 329
Expect: 100-continue
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body>[...]</s:Body></s:Envelope>
Receive:
HTTP/1.1 401 Unauthorized
Content-Type: text/html
Server: Microsoft-IIS/6.0
WWW-Authenticate: Basic realm="myrealm"
X-Powered-By: ASP.NET
Date: Tue, 31 May 2011 13:09:33 GMT
Cache-Control: proxy-revalidate
Content-Length: 1656
Proxy-Connection: Keep-Alive
Connection: Keep-Alive
Proxy-support: Session-based-authentication
Age: 0
[...]
4th request:
Send:
POST http://www.myservice.com/service.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://tempuri.org/MyMethod"
Accept-Encoding: gzip, deflate,gzip, deflate,gzip, deflate,gzip, deflate
Authorization: Basic Y29nZW50YVxjb21ldC1kbTM6Kmh0JTg2NCU=
Proxy-Authorization: NTLM TlRMTVNTUAABAAAAB7IIoggACAAxAAAACQAJACgAAAAFASgKAAAAD1dTUkswNDg3MENPTUVUTkVU
Host: www.myservice.com
Content-Length: 0
Receive:
HTTP/1.1 400 Bad Request
Date: Tue, 31 May 2011 13:09:33 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 4.0.30319
Cache-Control: private, proxy-revalidate
Content-Length: 0
Proxy-Connection: Keep-Alive
Connection: Keep-Alive
Age: 0
I don't understand why it doesn't send the envelope in the 4th request. The two handshakes are done, so theoretically everything should be fine.
When I do this locally without the NTLM proxy, the envelope gets sent as expected:
1st request:
Send:
POST http://www.myservice.com/service.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://tempuri.org/MyMethod"
Host: www.myservice.com
Content-Length: 329
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body>[...]</s:Body></s:Envelope>
Receive:
HTTP/1.1 401 Unauthorized
Content-Length: 1656
Content-Type: text/html
Server: Microsoft-IIS/6.0
WWW-Authenticate: Basic realm="myrealm"
X-Powered-By: ASP.NET
Date: Tue, 31 May 2011 13:31:46 GMT
[...]
2nd request:
Send:
POST http://www.myservice.com/service.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://tempuri.org/MyMethod"
Accept-Encoding: gzip, deflate,gzip, deflate
Authorization: Basic Y29nZW50YVxjb21ldC1kbTM6Kmh0JTg2NCU=
Host: www.myservice.com
Content-Length: 329
Expect: 100-continue
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body>[...]</s:Body></s:Envelope>
Receive:
HTTP/1.1 200 OK
Date: Tue, 31 May 2011 13:31:47 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 4.0.30319
Set-Cookie: ASP.NET_SessionId=svv4i11awg05v1j5viz1impo; path=/; HttpOnly
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 5127
[...]
I had to change the server security configuration to accept Digest authentication. For some reason that works while Basic doesn't.
I encountered a potentially similar issue and believe in my case this may be related to the establishment of the original NTLM connection to the proxy.
In my experience I had three requests going out in sequence each hour, with a retry configured.
Of these requests two would work, one would fail with a 400, and then when the first retried it worked as well.
There is a similiar issue with IE identified here: http://blogs.msdn.com/b/asiatech/archive/2012/01/30/400-bad-request-when-posting-webservice-or-wcf-request-from-ie.aspx
I ran some network traces and watched the behaviour and noticed that often the TCP Streams seemed to get shared, so that one of the requests would end up sending an NTLM authentication message (the zero content length) to the proxy after the other had already authenticated. In this situation the proxy just passed through the zero content message (as the stream had already authenticated).
What fixed it for me was moving to a WCF-Custom customBinding (using textMessageEncoding with a messageVersion of Soap11 to maintain my basicHttpBinding behaviour) and (not sure if required) setting keepAliveEnabled to false.
Unfortunately I doubt this is much help for your particular situation, but more info never hurts.

Why doesn't Jayrock (.NET JSON-RPC Framework) like my request?

Hi quick question about Jayrock... I have a Jayrock JSON-RPC web service that generally works fine. However, when I try to post to my jqGrid editUrl, Jayrock throws an error. The web service works fine in other situations.
Anyone have a clue why Jayrock doesn't like the following request? Perhaps a way to configure Jayrock to accept this request?
Request:
POST
/StoryManager/StoryManager.ashx/setPageItemRoles
HTTP/1.1
Host: localhost:2064
User-Agent: Mozilla/5.0 (Windows; U;
Windows NT 5.1; en-US; rv:1.9.1)
Gecko/20090624 Firefox/3.5 (.NET CLR
3.5.30729)
Accept: */*
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset:
ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Content-Type:
application/x-www-form-urlencoded;
charset=UTF-8
X-Requested-With: XMLHttpRequest
Referer:
http://localhost:2064/StoryManager/PageItemDetail.aspx
Content-Length: 183
Cookie:
ASP.NET_SessionId=uycy1qmowzzqhiac1kg3e455
Pragma: no-cache
Cache-Control: no-cache
title=Narrative&assignedto=dfghdfgh&assigned=2009-06-25T14%3A52%3A24.0868931-05%3A00&due=2009-08-02T14%3A52%3A24.0868931-05%3A00&completed=2009-07-17T14%3A52%3A24.0868931-05%3A00&id=3
Response:
{"id":null,"error":{"name":"JSONRPCError","message":"Found
String where Object was
expected.","stackTrace":" at
Jayrock.Json.JsonReader.ReadToken(JsonTokenClass
token) in
c:\Projects\Public\Jayrock\rel\rel-0.9.8316\src\Jayrock.Json\Json\JsonReader.cs:line
142\r\n at
Jayrock.JsonRpc.JsonRpcDispatcher.ParseRequest(TextReader
input) in
c:\Projects\Public\Jayrock\rel\rel-0.9.8316\src\Jayrock\JsonRpc\JsonRpcDispatcher.cs:line
271\r\n at
Jayrock.JsonRpc.JsonRpcDispatcher.Process(TextReader
input, TextWriter output) in
c:\Projects\Public\Jayrock\rel\rel-0.9.8316\src\Jayrock\JsonRpc\JsonRpcDispatcher.cs:line
127","errors":[{"name":"JsonException","message":"Found
String where Object was expected."}]}}
Because you send application/x-www-form-urlencoded request with "form-like" post data instead of application/json with correct json object.