I solved the problem. I did not have an & between my two parameters in the POST body.
Adding & between the text and user parameter fixed it. Thanks Matt. On Jun 21, 1:10 pm, themattharris <thematthar...@twitter.com> wrote: > Hey Dave, > > Looking through your signature base string just a couple of things > which jump out and would be worth checking: > * There are some spaces in the nonce and timestamp where there > shouldn't be. In all honesty this is most likely email formatting > problems but I wanted to point it out just in case. > * Your text is encoded three times which isn't good and could be the > source of the problem depending on what else you are doing when you > send your request. I want to rule it out as a symptom so can you take > a look at that, and why it is encoded one extra time. When I run tests > I see my text string similar to text%3Djust%2520a%2520simple > %2520message%2520test. yours, in it's current encoding, would read as > just%252520a%252520simple%252520message%252520test. > > Matt > > On Jun 18, 9:54 am, Acme Dave <acmedav...@gmail.com> wrote: > > > > > Thanks Matt, > > > I am still having problems. Here is the output of my test app. > > I am able to update status. So I know my POST logic is working correctly. > > > Info sigBase: POST&http%3A%2F%2Fapi.twitter.com > > %2F1%2Fdirect_messages%2Fnew.xml&oauth_consumer_key%3DCKEY%26oauth_nonce%3D > > 5855976111049200858%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp% > > 3D1276879684%26oauth_token%3DATOKEN%26oauth_version%3D1.0%26text%3Dyes%2525 > > 20very%252520good%252520message%26user%3DTOUSER > > > Info url:http://api.twitter.com/1/direct_messages/new.xml > > > ERROR during token access exchange: java.io.IOException: Server returned > > HTTP response code: 401 for > > URL:http://api.twitter.com/1/direct_messages/new.xml > > > Extended error response: <?xml version="1.0" encoding="UTF-8"?><hash> > > <request>/1/direct_messages/new.xml</request> <error>Incorrect > > signature</error></hash> > > > On Fri, Jun 18, 2010 at 9:21 AM, themattharris > > <thematthar...@twitter.com>wrote: > > > > Hi Dave, > > > > I seemed to have missed your message originally. Are you still > > > experiencing problems with this? > > > > In answer to your question there isn't anything special required for > > > signing requests to send direct messages. If you are still having > > > problems can you provide us with your signature base string (without > > > any tokens/keys). > > > > Matt > > > > On Jun 11, 9:32 am, ds <acmedav...@gmail.com> wrote: > > > > I am having trouble sending a direct message with: > > >http://api.twitter.com/1/direct_messages/new.xml > > > > > I have been able to successfully post status updates with my code > > > > using oAuth. > > > > I have a java based custom application that is working fine for these > > > > updates. > > > > > When trying to post a direct message I get 402 errors with "incorrect > > > > signature". > > > > > Basically I am using the same signature generation as update except I > > > > replace > > > > status with text and add user at the bottom of signature generation. > > > > Just like > > > > the oAuth example page on twitter. > > > > > Then I pass the two parameters in the request body. > > > > > I also tried moving everything to url parameters but got the same > > > > error. > > > > > Is there anything special about parameters for direct message when > > > > using > > > > oAuth? > > > > > Does it sound like I am doing this correctly with my post/body method? > > > > > Thanks, > > > > ...Dave