Hi Vimal,

Write actions like direct_messages/new should be used with an HTTP POST and
the parameters you want to send to the resource should be sent in the POST
body. Additionally, there are business logic rules with direct messages --
one such rule is that the recipient of the message needs to be following the
sender.

Here's a little on how the request would work with OAuth, if I was sending
the message "Hello" to @episod:

Signature base string example (used to compute your oauth_signature)
POST&https%3A%2F%2Fapi.twitter.com
%2F1%2Fdirect_messages%2Fnew.xml&oauth_consumer_key%3Dri8JxYK2ddwSV5xIUfNNvQ%26oauth_nonce%3DIEBMCsz226ngPNe2vzZkkHIm3moBB64WfXP1uj0Jjo%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1300199092%26oauth_token%3D119476949-gF0B5O1Wwa2UqqIwopAhQtQVTzmfSIOSiHQS7Vf8%26oauth_version%3D1.0%26screen_name%3Depisod%26text%3DHello

POST body
text=Hello&screen_name=episod

Authorization HTTP header:
OAuth oauth_nonce="IEBMCsz226ngPNe2vzZkkHIm3moBB64WfXP1uj0Jjo",
oauth_signature_method="HMAC-SHA1", oauth_timestamp="1300199092",
oauth_consumer_key="ri8JxYK2ddwSV5xIUfNNvQ",
oauth_token="119476949-gF0B5O1Wwa2UqqIwopAhQtQVTzmfSIOSiHQS7Vf8",
oauth_signature="3Qa0Med9nscjWdpprRKDCfSbuoE%3D", oauth_version="1.0"

After execution, I get a representation of the sent DM back in XML:
<?xml version="1.0" encoding="UTF-8"?>
<direct_message>
  <id>2613595065</id>
  <sender_id>119476949</sender_id>
  <text>Hello</text>
  <recipient_id>819797</recipient_id>
  <created_at>Tue Mar 15 14:24:52 +0000 2011</created_at>
  <sender_screen_name>oauth_dancer</sender_screen_name>
  <recipient_screen_name>episod</recipient_screen_name>
  <sender>
   ....
  </sender>
   .....
</direct_message>

Taylor

@episod <http://twitter.com/episod> - Taylor Singletary - Twitter Developer
Advocate


On Tue, Mar 15, 2011 at 5:45 AM, vimal <[email protected]>wrote:

> Hi
>
> Am a developer working for a social networking website company, Am
> trying to access the API's provided by twitter.
>
> I have a problem in accessing the API method direct_messages/new which
> is under Direct Messages Resources ,
> I couldn't get the xml file or data if i provide multiple parameters
> like screenname = "value",text="description"
>
> Could  you help me about this API on how to pass multiple required
> parameters in the querystring.
>
> Am accessing the API only after getting authentication from Twitter
> for the user,
>
> --
> Twitter developer documentation and resources: http://dev.twitter.com/doc
> API updates via Twitter: http://twitter.com/twitterapi
> Issues/Enhancements Tracker:
> http://code.google.com/p/twitter-api/issues/list
> Change your membership to this group:
> http://groups.google.com/group/twitter-development-talk
>

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk

Reply via email to