Job Posting API: First Steps
The Job Posting API is a RESTFul web service that uses two-legged OAuth for authentication. This explains the process of posting your first job using our Jobs API.
Step 1. Get Your API Keys
Get your API keys. These keys are needed to identify you. After you sign up, you will be given an "API Key" and "Secret Key". These are sometimes called a "Consumer Key" and "Consumer Secret". They are the same thing.
Step 2. Contact Us to Upgrade Your Account
Contact email@example.com and give us your Application Name (this what you typed in the box when we asked you to name your application) and API Key. We do not need the Secret. Once we have this, we can upgrade your API account to enable access to the Job Posting API.
Step 3. Assemble your Job Posting XML
This XML contains the information about the job in a simple sample that you can use to get started. After you've successfully posted using the example XML, you can read how to build your own XML for your jobs postings.
Two fields are important to call out: contract-id and partner-job-id.
The contact-id identifes the Job Posting contract (aka CAP contract, in LinkedIn lingo) tied to the company (or division of the company) you're posting jobs on behalf of. This information must come from the customer and the customer much also explicitly grant your application access to post jobs on their behalf. (Manisha: Link to general CAP customer CS FAQ on this.)
For testing purposes, you have been granted access to post to contract-id 1328. This is what you should use while getting up and going.
The partner-job-id is a unique ID (string of up to 50 characters) that you create to identify the job and refer to it in our system. Frequently, this is the key you use in your internal systems, but it can be whatever works for you.
The partner-job-id must be unique across all the jobs you post to a specific contract-id. Since all partners share the same test contract, you should change this value from the default in the example XML to something including your company name.
For now, ignore the other values in the XML document. They can be explored after you successfully post the sample.
Step 4. Install an OAuth Library
If you have not used OAuth before, you need to download and install an OAuth library. This library is necessary to sign your requests, so LinkedIn can validate that they're coming from you.
We suggest the following libraries:
- PHP: pecl/oauth
- Java: Scribe
- C#: There is no full OAuth library, but we have samples using the OAuthBase signing library
- Python: oauth2
- Perl: Net::OAuth
Other libaries may work, but these are ones we have validated with the Jobs Posting API and can most efficiently help you debug. If you are already using another library, we will do our best to work with you on any issues that may arise. You can read about Authentication for Job Posting to get more information on this, but the samples we've provided here should be sufficient for your first test post.
Step 5. Make the Request
To speed the process of making your first Jobs API call, here are links to sample code that you can use.
Notes: You must change the API_KEY and CONSUMER_KEY variables to your own from Step 1. And you also load in the XML file which you retrieved in step 3.
A successful request will receive a 201 Created HTTP Status Code, along with a Location HTTP header. An unsuccessful request will receive a 4xx or 5xx error.
If you are getting an error, here's some tips to help debug.
- Make sure you are setting a Content-Type HTTP Header of "text/xml".
- Make sure you are properly making a two-legged request. How to do this varies widely across libraries. Some use another method. Some require you to set an access token and access token secret of "" (the empty string). Some require you to not set an access token and access token secret. If you're unsure about the library you're using, try one of the examples from this page so you can see how a successful request works.
- If you are getting a 401 Unauthorized error, use the OAuth Tester tool (http://developer.linkedinlabs.com/oauth-test/) to validate if your OAuth signature is correct. The Member Token and Member Secret should be empty.
- If you are getting a 409 (Conflict) error, please change the partner-job-id within the XML to a unique value.
- If you are getting a 401 error with a body of "Not allowed to write to contract" contact firstname.lastname@example.org to make sure you've been added to contract 1328.
If all else fails, email email@example.com and someone will help you out.
Using other OAuth Libraries
If you are using another language or library, it's still worthwhile to read the sample code, as it may give you a hint about all the necessary steps. In general, the steps to create a POST for the system with any library will be:
- Create an OAuth consumer client with your consumer key and secret
- Create the body (using the example XML file)
- Set the headers for the consumer client
- Make the request
- Check the response code and location header
- Core Concepts
- Job Posting
- Share and Social Stream
- Libraries and Tools
- LinkedIn Policies