Sign in to follow this  
Followers 0
meisandy

Dealing with JSON response to Twitter API

2 posts in this topic

Hi All,

Long time no post - the forum has changed a lot since I was last here! Hope you are all ok.

Anyway, the reason I'm here is because I'm writing a program that needs to post a Tweet to a Twitter account. I am using the >Twitter UDF, which I have already adapted slightly so that once a user has logged in once the username and password is not need because the OAuth token and OAuth token secret is stored and used again, rather than regenerating a them each time the program is launched. However, since the UDF was last updated Twitter has updated their API and retired the use of XML so now the response is only given in JSON.

Fortunately, to get the UDF tweeting again it was simply a case of changing the URL that the data was POSTed to. However, because IE doesn't actually render/display JSON files, whenever the data is sent a File Download dialog appears asking to download the JSON file that is returned.

Does anyone know a way around this to stop the dialog appearing, other than sending a keypress when the window is detected?

Thanks in advance

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi ,

I have verified the modified twitter udf as explained in the below mentioned posts and it works as per the Twitter API V1.1 .

If there anything else you would want in this UDF ?

Regards

Edited by DeltaRocked

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • satanico64
      By satanico64
      hi guys !
      how are you ? fine ? yeahhh
      Here is my problem:
      I have 2 autoit applications, a.exe and b.exe
      In a.exe, i call b.exe with a json as parameter:
      FileWrite("N:\+++ Dev\ClientServeur\FolderMonitor.nca", "lejson in A:" & Json_Encode($json_tmp)& @CRLF) Run(@ScriptDir & "\FolderMonitor.exe " & Json_Encode($json_tmp) )                        
              In program B:
      ;Firstline of program: FileWrite("N:\+++ Dev\ClientServeur\FolderMonitor.nca", @CRLF & "json in B:" & $CmdLine[1] & @CRLF)        
              Output:
                     
              lejson in A:{"DOSSIERS":{"Dossier_Hidden":"N:\\+++ Dev\\ClientServeur\\","Dossier_du_script":"N:\\+++ Dev\\ClientServeur\\","Fichier_Historique":"N:\\+++ Dev\\ClientServeur\\Historique.log","Fichier_DEBUG":"N:\\+++ Dev\\ClientServeur\\FolderMonitor.nca"}}
              json in B  :{DOSSIERS:{Dossier_Hidden:N:\\+++ Dev\\ClientServeur\\,Dossier_du_script:N:\\+++ Dev\\ClientServeur\\,Fichier_Historique:N:\\+++ Dev\\ClientServeur\\Historique.log,Fichier_DEBUG:N:\\+++ Dev\\ClientServeur\\FolderMonitor.nca}}
      As you see, i lost my quote in my json so it's au problem to parse my json.
      I use THIS library
      I tried different type of encoding (ex JSON_STRICT_PRINT), but i don't think that it's the problem. Maybe i'm wrong
       
      thanks
      Nicolas.
    • wakillon
      By wakillon
      HttpHeaderWatcher v1.0.1.3
       

      Some time ago, some members asked how to see the Http Requests.
      There are quite a few external applications but not in AutoIt!
      HttpHeaderWatcher in association with WinPcap, very modestly solves this lack.
       
      Once done this http watcher, i asked me : why not Re-build a WinHttp Request in AutoIt from a selected Request in one Click ?
      So i have added a "Create au3" button who open the WinHttp Request of your choice in AutoIt format in SciTE Editor.
      Voila voila, hope it can help ! 
      Buttons were made online with chimply.com the easy and free buttons generator !
      See Help for more infos.
      previous downloads : 253
      source and executable are available in the Download Section
      Hope you like it !
    • jandings
      By jandings
      Hello there,
      since I spent some time to access the REST-API of the web shop system Shopware, I'd like to share a few lines to make life easier for others.
      With this you can access your Shopware database, reading and writing all kind of data. 
      Replies are JSON style.
      To work with JSON I usually depend on either just own AutoIt string operations or this AutoIt library:
      ; File        : Json.au3 (2015.01.08)
      ; Purpose    : A Non-Strict JavaScript Object Notation (JSON) Parser UDF
      ; Author    : Ward
      $UserName="xxxx" ;Shopware credentials of Shopware user who has the API checkbox ticked $PassWord="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ;API-Key of this user, NOT the Password $URL="www.XXX.com/api/" $Command="orders/64682?useNumberAsId=true" ;A list of commands and options is available through shopware REST-API help; Here we read order number 64682 $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET", "https://" & $URL & $Command , False) $oHTTP.SetCredentials($UserName, $PassWord, 0) $oHTTP.Send() $response = $oHTTP.ResponseText ConsoleWrite ($response & @CRLF & @CRLF)  
    • nznet
      By nznet
      Hi Guys,
      I have been trying to write the API calls to Coinigy.com in AutoitScipt. I have managed to solve most of them put are having trouble with the ones that require parameters to be passed.
      The source to the API calls can be found here:
      http://docs.coinigy.apiary.io/#reference/market-data/market-data/data-{type:history}
      Example code from this site:
      curl --include \      --request POST \      --header "Content-Type: application/json" \      --header "X-API-KEY: " \      --header "X-API-SECRET: " \      --data-binary "    {         \"exchange_code\": \"GDAX\",         \"exchange_market\": \"BTC/USD\",         \"type\": \"history\"     }" \ ' https://api.coinigy.com/api/v1/data '  
      This data one is really annoying me. I have the following so far:
      #include <Array.au3> #include <string.au3> #include <MsgBoxConstants.au3> #Region Coinigy Const Global $sCoinigyAPIUrl = "https://api.coinigy.com/api/v1/" #EndRegion Coinigy Const #Region keys Global Const $sCoinigyAPIKey = "" ; just removed my APIKey Global Const $sCoinigyAPISecret = "" ; just removed my APISecret #EndRegion keys $sResults = CoinigyQueryPrivate("data", "exchange_code=GDAX&exchange_market=BTC/USD&type=history") ; Trade history, asks and bids for any supported exchange/market ConsoleWrite("Market Data: " & $sResults & @CRLF & @CRLF) Func CoinigyQueryPrivate($sMethod, $sParameters)     Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")     $oHTTP.Open("POST", $sCoinigyAPIUrl & $sMethod, False)     $oHTTP.SetRequestHeader("X-API-KEY", $sCoinigyAPIKey)     $oHTTP.SetRequestHeader("X-API-SECRET", $sCoinigyAPISecret)    ; $oHTTP.Send(Binary($sParameters)) ; tried this as well     $oHTTP.Send($sParameters)     Local $sReceived = $oHTTP.ResponseText     Return $sReceived EndFunc   ;==>CoinigyQueryPrivate  
      If I do other queries that don't require Parameters they work perfectly. I am just totally stumped by the parameter passing queries. I have tried everything and I still can't get it to go. Would really appreciate some help.
      If you want to try for yourself live, Coinigy.com give a free 30 trial.... 
      Please help...
      Thanks in advance.
    • falcontechnics
      By falcontechnics
      Dear master, hello,
      I got the speech API from Google. But I could not find how to use. Could you help me with a simple example?
      "https://speech.googleapis.com/v1/speech:recognize?key=MyKey"