The util/getCategories method is an Elance Developer API Util method that returns a list of all categories and sub-categories defined within the Elance system.

A category is a label, such as "Web & Programming," that can be applied to both jobs and providers. Each category is assigned a unique ID. Each top-level category may have a number of child categories defined beneath it; these are used to delineate a category into more precise sub-divisions.

util/getcategories is an unauthenticated method. It requires a valid Elance Developer API key, but does not require HTTP authentication. It is invoked using an HTTP GET request.

This method can return straight JSON data, or a Javascript callback. The name of the callback is specified using the jsonp query string parameter.

For more information on the format of an Elance Developer API request, see Getting Started.

tableofcontents_number_textRequired Query String Parameters

Beyond the parameters specified in Getting Started, this API method has no required query string parameters.

tableofcontents_number_textResponse Data Description

For JSON responses, unless otherwise noted, all parameters are returned as JSON string types. The value in the Data Type column denotes the type to which the property can safely be cast.

Property Data Type Description
catId integer The unique integer ID assigned to this label.
catName string The human-readable name for this category.
children Array of Category objects The child categories belonging to this category. If no list of Category objects is provided, then this category is either a top-level category or a leaf node.
parentId integer The unique ID of this category's parent category. If the current category is a top-level category, this property is undefined.

tableofcontents_number_textRequest/Response Examples in JSON

tableofcontents_number_textRetrieve List of All Categories

The following example HTTP GET request retrieves a list of all categories and sub-categories currently in use on the Elance system. The example uses the curl command line utility.

tableofcontents_number_textRequest

curl "http://api.elance.com/api/util/getCategories?oauth_consumer_key=ewsf234sdf23aswer34vwer235fwe13werwq43&debug=true&fmt=json"

tableofcontents_number_textResponse

{
    "api" : "util\/getCategories",
    "apiVersion" : 1,
    "rcode" : 1,
    "data" : {
        "10179" : {
            "catId" : 10179,
            "catName" : "Admin Support",
            "children" : {
                "12535" : {
                    "catName" : "Bulk Mailing",
                    "parentId" : "10179",
                    "catId" : 12535
                } , //...
            }
        }
    }
}

tableofcontents_number_textError Codes

For a list of error codes that can be thrown by this method, see Common API Error Codes.