Partager via


Close Jobs

To close a job, re-post the job using the same externalJobPostingId value, but set jobPostingOperationType to CLOSE.

API Overview

Use the /simpleJobPosting API to create, update, renew and close jobs on LinkedIn. This wiki describes how to close jobs. To know more about this API, refer to API Overview.

API Endpoint

Use the following endpoint to submit a task to create, close, update, or renew one or more jobs asynchronously:

POST https://api.linkedin.com/v2/simpleJobPostings

API Authorization

All requests below require access tokens obtained via the OAuth2.0 Client Credentials flow.

Important

We strongly recommend to use same access token for all concurrent and consecutive calls. An access token has a lifespan of 30 mins. Only on expiry of the existing token, new token should be generated.

Sample Request for Premium Jobs

API Header:

The header for making the request is X-Restli-Method: batch_create.

Authorization: Bearer {token}
x-restli-method: batch_create

Sample Request Body:

{
    "elements": [
        {
            "listingType": "PREMIUM",
            "companyApplyUrl": "http://localhost:0000",
            "contract": "urn:li:contract:{{contract_id}}",
            "industries": [
                "urn:li:industry:55"
            ],
            "externalJobPostingId": "TEST_150421",
            "description": "Lorem Ipsum is simply dummy text of Lorem Ipsum.",
            "listedAt": 0123456789,
            "title": "JOB_1_TEST_150421",
            "integrationContext": "urn:li:organization:{{company_id}}",
            "location": "San Francisco, California",
            "jobPostingOperationType": "CLOSE"
        }
    ]

Error Codes

Given below is a list possible error codes that can display while closing a job.
One of the following responses is returned, that contains a JSON object with a status and a message about the error for Post on /simpleJobPostings.

HTTP CODE RESPONSE STATUS ERROR MESSAGE DESCRIPTION RESOLUTION
200 422 ERROR :: /{mandatory key} :: field is required but not found and has no default value Required field is missing in the request body Refer to the schema documentation and make sure all the required fields are present in the request body
200 422 ERROR :: /{attribute_name} :: {value} cannot be coerced to Long\n, (Why is \n coming in error message) When value of the attribute does not match the datatype it accepts. For example, title accepts String but we have provided numerical value Ensure that the value provided for attribute should match the datatype it accepts. Refer to schema documentation for data types of the attributes
200 422 ERROR :: /jobPostingOperationType :: "UPDATED" is not an enum symbol\n Wrong value provided for the field jobPostingOperationType The value should either be one of following CREATE, UPDATE or CLOSE
401 401 Invalid access token Access token is tampered Regenerate a new access token
401 401 The token used in the request is expired The access token used in Authorization header is a valid token but it has expired Regenerate a new access token
403 403 Caller is not authorized to access the jobs for contract: urn:li:contract:{contract_id} The application used for posting premium job does not belong to the Job posting contract 1. Ensure that you are using the correct contract details provided in the Premium Job Posting onboarding email
2. Ensure that you are using the correct application credentials
403 403 Not enough permissions to access: POST /simpleJobPostings The application does not have enough permissions to use /simpleJobPostings API Ensure that the header x-restli-method with value batch_create is present
500 500 Internal Server Error When incorrect attribute type is given. For example, Integer instead of String Please check if externalJobPostingId datatype is string in request body