Hi, It worked great, did not have to do anything else than alter the encode, as mine based on w3schools was wrong (!) :)
Thanks for the great help, Thomas On Jan 25, 2:53 pm, Taylor Singletary <[email protected]> wrote: > Hi there, > > First just a note that you should use the proper API path > ofhttps://api.twitter.com/1/direct_messages/new.xmlfor this request -- API > URLs without version numbers or the api subdomain aren't supporting and can > have unexpected results. > > I think that your problem might be that your POST body needs to be validly > escaped prior to becoming part of your signature base string. > > The phrase "Æ Ø Å and æ ø å..." should become > "%C3%86%20%C3%98%20%C3%85%20and%20%C3%A6%20%C3%B8%20%C3%A5..." for the POST > body to be valid. > > Now that you've escaped the values for your POST body, you feed them into > your signature base string creation process, which requires that the %'s be > escaped... so this becomes: > > "%25C3%2586%2520%25C3%2598%2520%25C3%2585%2520and%2520%25C3%25A6%2520%25C3%25B8%2520%25C3%25A5..." > > Let me know if this helps. > > Thanks! > Taylor > > On Mon, Jan 24, 2011 at 10:51 PM, THusvaeg <[email protected]> wrote: > > Hi, > > > I have a working api integration with the following setup: > > > ----------------------------------------------------------------------- > > > var strText = Inputs.GetProperty("DMTxt"); > > var strUser = Inputs.GetProperty("DMUser"); > > > var strTextEnc = encodeString(strText); > > > var sBaseTargetString = "http://twitter.com/direct_messages/new.xml"; > > var sEncodedTargetString = encodeString(sBaseTargetString); > > > var sSignatureKey = sConsumerSecret+"&"+oauth_token_secret; > > > // Build Parameter String > > var sBaseParamString = "oauth_consumer_key="+sConsumerKey > > +"&oauth_nonce="+sNonce; > > sBaseParamString = sBaseParamString + "&oauth_signature_method=" + > > sSignMethod; > > sBaseParamString = sBaseParamString + "&oauth_timestamp="+sTimestamp; > > sBaseParamString = sBaseParamString + "&oauth_token=" + oauth_token; > > sBaseParamString = sBaseParamString +"&oauth_version="+sAuthVersion; > > sBaseParamString = sBaseParamString +"&screen_name="+strUser; > > sBaseParamString = sBaseParamString +"&text="+strTextEnc; > > > var sEncodedParamString = encodeString(sBaseParamString); > > > // Get signature > > var sBaseString = "POST&"+sEncodedTargetString > > +"&"+sEncodedParamString; > > > var sSignature = b64_hmac_sha1(sSignatureKey, sBaseString)+"="; > > var sEncSignature = encodeString(sSignature); > > > ----------------------------------------------------------------------- > > > And this works great for all but Æ Ø Å and æ ø å... > > > I have tried simply adding them to the encodeString() function as > > such: > > > sEncString = sEncString.replace(/\æ/g, "%E6"); > > sEncString = sEncString.replace(/\Æ/g, "%C6"); > > sEncString = sEncString.replace(/\ø/g, "%F8"); > > sEncString = sEncString.replace(/\Ø/g, "%D8"); > > sEncString = sEncString.replace(/\å/g, "%E5"); > > sEncString = sEncString.replace(/\Å/g, "%C5"); > > > But this returns a Status: 400 Bad Request > > > with the target url: > >http://twitter.com/direct_messages/new.xml?screen_name=thusv&text=%E6... > > > Any tips? > > > -- > > 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
