Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Oct 2006
    Posts
    345

    API Calls help needed

    Hi guys, i'm looking to try and create a small tool that can for upto 4 RS accounts, utilise their new API calls to get the account info, and thus keep a record of the points etc on a daily basis or one off checking.

    I've built some of it already, and have the pages of my project sort of defined, using 5 pages, front, settings, results, log and one with 4 http objects in it (not sure if this is needed yet)

    for the settings and resutls pages, i have made a "panel" out of an image,and created 4 account input boxes/tick boxes as required for each account and then 4 buttons to show or hide the relevant ones for the account you wish to deal with, the settings are then saved to an encrypted ini file and loaded at startup... this all works and i can swittch between the accounts and the display chages as i want

    now, the problem is, i suck when it comes to API calls lol

    I am not sure if i should load the API call into the http objects, and then save the result as a string, or if this will cause me issues trying to work across different pages in relation to accessing objects, or if i should be using the http built in functions... any help would be appreciated

    i might also have problems in the timer department, as i have an option to get details on startup or not, thus allowing you to use windows sheduler to start the tool at the required time to ensure you can log a daily total. but i also want a "check every..... mins" option, and on the reults page, a manual button.

    so as you can see i have a few things to work out yet

    here is the API call format
    Code:
    https://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=getaccountdetails_v1&type=col&login=XXXXXXXX&password=XXXXXXX
    full info on the Rapidshare API's can be found here if it helps
    Code:
    http://images.rapidshare.com/apidoc.txt

    any thoughts ? (and please keep any code examples compatible with AMS6 )

  2. #2
    Join Date
    Oct 2006
    Posts
    345
    ok, as expected i'm having trouble utilising the web objects due to lack of control/access from different pages, and for some odd reason i even had trouble coding the load by switching focus to that page and then trying to load the url (used no exit script on page jump code as well!)

    either way, i'm thinking that a webobject is just oo "clunky" to use.

    I was wondering if it was possible to use http.SubmitSecure ? ... this looks like it maybe more what i was looking for if i can get the data returned to a string, i can maniulate that much easier on the fly between pages without having to switch to that page.

    but again, i can't seem to find the right combination to get it to work :(


    This little "simple idea" is starting to look like a real pain in the ass, and AMS may not be well suited to it at all
    Last edited by qwerty; 06-23-2009 at 04:49 AM.

  3. #3
    Join Date
    Oct 2006
    Posts
    345
    ok, this is driving me up the wall !!

    Little function i have been calling, the initial idea was to use the HTTP.SubmitSecure, but i constantly get an "ERROR: unable to login" message returned using that and port 443, so i have been using the regular HTTP.Sumbit method.

    Code:
    function QueryAcct_1 (type, id, pass)
    	
    	Data_Values = {}
    	result = HTTP.Submit("https://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=getaccountdetails_v1&type=".. type.. "&login=".. id.. "&password=".. pass, Data_Values, SUBMITWEB_GET, 25, 80, nil, nil);
    
    	Dialog.Message("Notice", result, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    
    end
    now my thoughts behind an empty data table, are that the script to the api server requires no additional data other than what is contained in the address details, and i have tried various combinations of that information in the data values table, with zero successful returns, always resulting in some error, so... no data sumbitted should in theory result in everything being returned.... but nope, it gives a blank string on return


    so, i checked it first with the HTTPerror check routine and got "200" returned, which appears to indicate all is well

    then i checked it with Application Get Last Error, and that returned... "Could not open request"

    so i've kind of reached the end of my abilities and patience with this,.... and asked a friend to write me a small exe that i can pass the 3 variables to, and it will then return the string value, so i can just call his app when needed

  4. #4
    Join Date
    Oct 2006
    Posts
    345


    i got it sorted, not exactly how i expected to !.... because the way that call to the RS server works, it has a html source code ... perfect, as when you view the source it puts it in a nice somple table style layout... so, i went trawling, and camee up with this thread..

    http://www.indigorose.com/forums/showthread.php?t=23721

    and from that thread, i have no less that 3 solutions that i can use to pass the information and then return the source code, which just happens to be in a layout i think i can use

    First one i picked was worm's 2004 solution what do you know, it coughed up the information faster politician slithers away from direct questions !




    so, for anyone else contemplating playing with the RS API things, go after the source code for the page as your information return and you should be able to sort it fairly easily

  5. #5
    Join Date
    Aug 2003
    Posts
    2,427
    [soapbox]
    Glad you got your problem sorted. I'd hold this thread up as an example of good forum etiquette to some of the impatient posters we've seen in the past.

    If you don't get a reply, then it's because nobody has anything useful to say, don't take it personally and if you solve it yourself, then post the solution for the information of other members
    [/soapbox]

  6. #6
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    Quote Originally Posted by longedge View Post
    [soapbox]
    Glad you got your problem sorted. I'd hold this thread up as an example of good forum etiquette to some of the impatient posters we've seen in the past.

    If you don't get a reply, then it's because nobody has anything useful to say, don't take it personally and if you solve it yourself, then post the solution for the information of other members
    [/soapbox]
    Agreed. Always nice to see threads like this, quite entertaining actually hehe
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  7. #7
    Join Date
    Oct 2006
    Posts
    345
    Quote Originally Posted by Imagine Programming View Post
    quite entertaining actually hehe
    .... yeah thanks .... trust me i was doing my nut, cause i could not understand what i had done wrong.

    .... and, i still dont.... because as you saw, i was trying to use {} so i passed no values, now, you see that thread i linked, had 3 options... the excellent little DLL from worm, the new DLL and then the XML and LUA option, so, being of the "keep it simple" train of thought, i figured why use a DLL when there was no need, so i had a go at using the code, put it in the 2 locations as your supposed to, restarted AMS and viola, nice new function.... cool, even an idiot like me can do this i'm thinking, well... thats about as far as my thinking got, first responce back for the code was an empty string ... back to the drawing board! used EXACTLY the same api/address/login details and this time put it into worm's dll... voila, results... ok, back to the code, this time i forced it to give a wrong password, this should ALWAYS invoke a response from the server beginning "ERROR:..." but it didnt, i got the empty return again, indicating an error, now at this point, some of you would have tried the getlaserror, i on the other hand turned off my firewall, because i'm thinking maybe this is a port issue, but it made no difference, i tried 80 and 443 with and without firewall, nothing worked, put exactly the same code into the dll... bang, ERROR message telling me wrong login details.

    so i looked at the LUA code, and the XML... and realised, the LUA code was almost identical to what i had tried before re-searching a solution

    ... so, i have come to the conclusion, that whilst i may have been on the correct track, i was NEVER going to find a suitable solution, if the tried and tested method to get the source code, posted so long ago also fails

    but, the DLL from worm appears to work great, so i'm sorted.


    as for the other stuff, yeah, i assume if no replies then folks dont know, but i'll always try and use the thread i make as a sounding board, i may make one comment that someone reads and thinks "why dont you do this...." and that could solve my problem, so its kind of like thinking out loud :P

    and yeah, solutions are always good for those searching later (even if it's 4 years down the line as with worm's DLL !)


    now i have a new problem, so will go post that in a new thread :P

  8. #8
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    Hmz doesn't this work?:
    Code:
    function QueryAcct_1 (type, id, pass)
    	local Data_Values = {sub="getaccountdetails_v1", type=type, login=id, password=pass}
    	local result = HTTP.Submit("https://api.rapidshare.com/cgi-bin/rsapi.cgi", Data_Values, SUBMITWEB_GET, 25, 80, nil, nil);
    	Dialog.Message("Notice", result, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    end
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  9. #9
    Join Date
    Oct 2006
    Posts
    345
    gimmie 5 minutes, and i'll drop that exact code into the project and tell you the result, but i'm fairly sure i tried that combination

  10. #10
    Join Date
    Oct 2006
    Posts
    345
    Test Results...

    Dropping your code directly into my project (because you used the same variable names i had to change nothing)

    Dialog box returrns empty :(

    GetLastError reposrts - "Could not open request"

    HTTP.GetHTTPErrorInfo reports - "Download Error Info: 12007 - The server name or address could not be resolved" and "Server Status : 200"


    Thanks for trying, but like i said, i think it's a port issue or something odd, either way the server wont respond to that code format, however, worm's dll works perfectly (i also now know what happens if you accidentally place one function code inside a mirror of itself ! - you have to click the button twice, lol ...... could be handy at times that )


    also, just for info, that code freezes my fake progress swf animation !
    (which is my new problem !)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts