The search/jobs method is an Elance Developer API Search method that finds publicly available jobs matching the specified keywords and sorts the results.

Keyword searches are performed against all text fields of an Elance job record. Only records that contain all of the specified keywords will be returned.

Results are returned in fixed pages of 25 records each. By default, the first page of results is returned with an initial request; additional pages are requested by issuing subsequent requests on the same search with the page query string parameter. Results must be presented to end users in the same order as returned by the Search methods. Re-ordering the results is considered a violation of the Elance Developer API Terms of Service.

search/jobs 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_textOptional Query String Parameters

Parameter Description
keywords A space-delimited list of keywords to search. If omitted, search returns a list of all jobs.
sortCol The property by which to sort results. Valid values are:

budget
numProposals
startDate
endDate

sortOrder Whether to sort the results in ascending or descending order. If this value is specified without sortCol, it is ignored. Valid values are:

asc
desc

The default is desc.

page The requested page of result sets, numbered beginning from 1. Default is 1. If this number exceeds the value of the response property totalPages, the response will contain zero results.
catFilter A positive integer representing a category ID that restricts search results to jobs in the specified category. A list of valid category IDs and associated names is available through the util/getCategories method. If the value of catFilter does not correspond to an existing category ID, the method returns an empty result set.
subcatFilter A positive integer representing a subcategory ID that restricts search results to jobs in the specified subcategory. A list of valid subcategory IDs and associated names is available through the util/getCategories method. If the value of subcatFilter does not correspond to an existing category ID, the method returns an empty result set.

tableofcontents_number_textResponse Data Description

For JSON responses, unless otherwise specified, 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
totalResults integer The total number of jobs matching the search criteria.
totalPages integer (JSON number) The total number of page results available. Each page (response from the server) will contain the number of records specified in numResults.
page integer (JSON number) The current page of results.
numResults integer The number of results in the current page. This may be less than 25 if the last page of data is requested.
pageResults array of Job objects (specified below) The ordered set of results. Individual jobs are returned as child objects labeled by their sort order within the page, starting from 0.

tableofcontents_number_textJob Objects

Property Data Type Description
jobId integer The unique integer ID assigned to this job by Elance.
name string The title of the job, as provided by the client.
description string The description of the job, as provided by the client.
category string The Elance category under which the job was created.
budget integer The client's proposed budget for this job, in US dollars.
numProposals integer The number of proposals already submitted for this job.
startDate timestamp (JSON number) Job's bidding start date, expressed in seconds since January 1st, 1970.
endDate timestamp (JSON number) Job's bidding end date, expressed in seconds since January 1st, 1970.
jobURL URL The URL pointing to the full description of the job on Elance.

tableofcontents_number_textSample Request/Response in JSON

tableofcontents_number_textRetrieve All Most Recent Jobs

The following HTTP GET request retrieves a list of all current jobs in the Elance system, listed in descending chronological order from the date they were posted. It uses the curl command line utility.

tableofcontents_number_textRequest

curl "http:api.elance.com/api/search/jobs?oauth_consumer_key=8dfd475b57fee5b7dc08cc0f1d5a0fcdab409b3c"

tableofcontents_number_textResponse

{
     "api": "search\/jobs",   
	 "apiVersion": 1,   
	 "rcode": 1,   
	 "data": {     
	      "totalResults": "3280",     
		  "totalPages": 132,     
		  "page": 1,     
		  "numResults": "25",     
		  "pageResults": {       
		       "0": {         
			        "jobid": "19412626",         
					"name": "Hourly job",         
					"description": "What I need or require: \n\nOther context\/requirements that providers will need to know: \n \nWhat will be provided: \n\nSpecific expertise\/background that I am seeking: \n\nTimeframes:(ID: 19412626)",         
					"budget": "Between $500 and $1000",         
					"startDate": 1270770969,         
					"endDate": 1271980569,         
					"category": "Admin. Support",         
					"numProposals": "0",         
					"jobURL": "http:\/\/www.elance.com\/job?jobid=19412626"       
				},       
				"1": {         
					"jobid": "19412625",         
					"name": "WordPress Web site installation",         
					"description": "eastasta(ID: 19412625)",         
					"budget": "Between $500 and $1000",         
					"startDate": 1270765718,         
					"endDate": 1271975318,         
					"category": "Web & Programming",         
					"numProposals": "0",         
					"jobURL": "http:\/\/www.elance.com\/job?jobid=19412625"       
				},       
				"2": {         
					"jobid": "19412624",         
					"name": "Create banner for ",         
					"description": "testesatsat(ID: 19412624)",         
					"budget": "Less than $500",         
					"startDate": 1270765582,         
					"endDate": 1271975182,         
					"category": "Design & Multimedia",         
					"numProposals": "0",         
					"jobURL": "http:\/\/www.elance.com\/job?jobid=19412624"       
				}, 
				// Intervening data omitted.
				"24": {         
					"jobid": "19411482",         
					"name": "WorkviewMAC-001",         
					"description": "Test_JobDescription(ID: 19411482)",         
					"budget": "Not Sure",         
					"startDate": 1269933369,         
					"endDate": 1271142969,         
					"category": "Design & Multimedia",         
					"numProposals": "0",         
					"jobURL": "http:\/\/www.elance.com\/job?jobid=19411482"       
				}     
			}    
	} 
} 

tableofcontents_number_textRetrieve Second Page of Jobs Matching Keywords, Sorted by Number of Proposals

The following HTTP GET request retrieves the second page of that contain both the keywords "PHP" and "mySQL." It orders the result set by ascending number of proposals, so that the jobs with the lowest number of proposals are listed first. This sample uses the curl command line utility.

tableofcontents_number_textRequest

curl "http://api.elance.com/api/search/jobs?eauth_consumer_key=8dfc476b57fee5b7dc08cc0f1d5a0fcdab409b3c&keywords=php%20mysql&sortCol=numProposals&sortOrder=asc&page=2"

tableofcontents_number_textResponse

{
    "api":"search\/jobs",
    "apiVersion":1,
    "rcode":1,
    "data":{
        "totalResults":"249",
        "totalPages":10,
        "page":2,
        "numResults":"25",
        "pageResults":{
            "0":{
                "jobId":"20862350",
                "name":"Complete remaining 10% on eCommerce Web site",
                "description":"PHP and mySQL expertise needed immediately to complete eCommerce application. Send references and sample code. (ID: 20862350)",
                "budget":"Less than $500",
                "startDate":1281682105,
                "endDate":1282891705,
                "category":"Web & Programming",
                "numProposals":"1",
                "jobURL":"http:\/\/www.elance.com\/job?jobid=20862350"
            },
            "1":{
                "jobId":"21871850",
                "name":"Small PHP script needed to render alphabetize list",
                "description": "I want an alphabetical list for my site\n\nphp that grabs all my group list from a category and makes a alphabetical list that is separate abc.\n\nthat has a bubble when hover will pull info and thumbnail.\n\nthis is very simple to make so my budget is 50USD\n\nthanks just ask me i have some sample sites that have what i want.(ID: 21871850)",
                "budget":"Less than $500",
                "startDate":1281760302,
                "endDate":1282969902,
                "category":"Web & Programming",
                "numProposals":"1",
                "jobURL":"http:\/\/www.elance.com\/job?jobid=21871850"
            } // Other records omitted..
        }
    }
}

tableofcontents_number_textPHP and AJAX Examples

See Accessing Elance from PHP for an example of calling search/jobs from a PHP application. An AJAX example is provided in Accessing Elance from AJAX.

tableofcontents_number_textError Codes

For a list of possible errors, see Common API Error Codes. The format of error responses is specified in the Getting Started page.