Provide code examples in the API documentation

    • tburny ha detto...
    • Forum Moderator
    • Mag 28 2012, 10:36

    Provide code examples in the API documentation

    I am suggesting that the API documentatation should provide code examples, especially to the authentication section.

    Often, users seem to have difficulties with the authentication part, because it is sometimes a little bit abstract and you have to read very carefully.
    Major points here are building the API signature correctly, correct encoding and url escaping of parameters and making the auth.getSession request.

    It should be easily possible to add collapsible boxes using a link like "show sample code" .
    The sample code could either be pseudocode or could be a selection of the most popular programming languages languages for the web, like PHP, JavaScript, Java and maybe Ruby and Python. One should be able to select the desired language using a dropdown box then.
    It wouldn't be too much effort, but it would help users to understand the documentation far better, as they have concrete examples and code instructions for what to do.

    What do you think? Combine your favourite radio stations! | My Blog | scala-lastfmapi | Cache2k - A high performance Java in-memory cache
    P.S.: Do not click here
    throw new PokemonException(); //Gotta catch 'em all
    My forum post reflects my personal opinion :)
  • I agree, code examples would help greatly. Actually your example of confusion with the auth.getSession request is exactly what brings me to the forum. Thank you.

    I'm writing a desktop program and have managed to get as far as step 4. What I'd like to know is what is the proper format to fetch the web service session(sk)? I figured the actual call would look similar to the gettoken method plus the token and api_sig, but it just returns an error13.
    Here's an example of what I am apparently doing wrong:

    I know need to do this before i can go on to step 5 and 6. I am a bit confused. :/

    • JRoar ha detto...
    • Alumni
    • Giu 7 2012, 19:24
    DaMonte81 said:
    I figured the actual call would look similar to the gettoken method plus the token and api_sig

    That is correct. In Step 6 there is an example of how to construct the signature for this exact method (auth.getSession). Feel free to open a new thread if you still have problems (and include your code).

  • [spam]


    Modificato da bengt_bangt in data Giu 12 2012, 13:31
    • tvalent2 ha detto...
    • Utente
    • Giu 27 2012, 21:47


    I'm surprised the docs don't already have this.

Gli utenti anonimi non possono inviare messaggi. Per inserire messaggi nei forum, accedi o crea il tuo account.