Worksheet: Using jQuery with the API Download


1. Fill out these values to get you started:

Fill out these form elements to get the API tester ready to query the Local Ground API.


2. Before Each Request

Before each request, be sure to include the Basic Authentication headers. You can do this by including a "beforeSend" function with each request, or by initializing the ajaxSetup script when your page loads as follows:

$.ajaxSetup({
    beforeSend: function(xhr){
        xhr.setRequestHeader("Authorization",
            "Basic " + btoa(username + ":" + password));
    }
});

3. OPTIONS POST, {'_method': 'OPTIONS}

Use the POST, {'_method': 'OPTIONS} action when you want to find out which actions and fields are available for a particular resource or resource list.

    
        


        

4. GET

Use the POST action when you want to query a resource or set of resources.

    
        


        

5. POST

Use the POST action when you want to create a new resource.



        

6. PUT

Use the PUT action when you want to update a resource.


            

        
        

7. PATCH

Use the PATCH action when you only want to update only some of the resource's fields.


            

        
        

8. DELETE

The delete request permanently deletes internet resources. This cannot be undone.