Introduction


Overview

The entire API is set up to be as RESTful as possible. To use the API, you need a client that supports the major HTTP/1.1 verbs (PUT, POST, DELETE, and GET). Because the Guitarparty API is a simple REST API that runs over HTTP, it can be accessed by any HTTP-capable application or device with an internet connection.


Authentication

To use the Guitarparty API you must provide an API key with each request you make to the API.

You can get an API key here (must be a Guitarparty user and logged in).

You can authenticate a request by simply including a custom header named Guitarparty-Api-Key, like in the following example:

curl -H 'Guitarparty-Api-Key: {API_KEY}' http://api.guitarparty.com/v2/songbooks/

{API_KEY} would naturally be substituted by your own API key.

Authentication in javascript is also possible. This example sets all jQuery ajax requests up with the proper authentication:

var API_KEY = 'your-api-key';
$.ajaxSetup({
    beforeSend: function(xhr) {
        xhr.setRequestHeader('Guitarparty-Api-Key', API_KEY);
    }
});

In C# you simply set a custom request header named Guitarparty-Api-Key:

    string songJson = "";
    // Create the web request 
    HttpWebRequest request = WebRequest.Create("http://api.guitarparty.com/v2/songs/5/") as HttpWebRequest;
    request.Headers["Guitarparty-Api-Key"] = "your-api-key";
    // Get the response
    using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
    {
        // Get the response stream 
        StreamReader reader = new StreamReader(response.GetResponseStream());
        // save the JSON data to a string
        songJson = reader.ReadToEnd();
    }

‚Äč