次の方法で共有


Migration Guide - Updated API Request Maximum Length

To improve our network infrastructure and better serve API traffic globally, LinkedIn will begin rejecting API calls not meeting new criteria starting April 30, 2022.

Requirements

Ensure your LinkedIn API requests comply with the following size requirements. If your request exceeds any of the size requirements listed below, your request will receive a 414 response.

Request parameter Size in KB
Raw URL 8 KB max length (scheme + hostname + port + path + query string of the URL)
Query String 4 KB max length
Request URL 28 KB max length (headers + cookies + URI + queryString, but excluding POST data)
URL path segment 4 KB max characters (the area between slashes in a URL)

Query Tunneling

To support these requirements, we’re introducing the concept of query tunneling. This feature allows you to modify your existing requests with a custom header to easily resolve offending requests.

Requests without Body

  1. Change the request from GET to POST.
  2. Add the X-HTTP-Method-Override header, using the original HTTP method (-H "X-HTTP-Method-Override: GET").
  3. Add the Content-Type header (-H "Content-Type: application/x-www-form-urlencoded").
  4. Move the query string to the body of the request.

Example

Let’s use the example request below to see how we can quickly convert our existing request to the organizationalEntityAcls API using query tunneling.

Current Request
curl -X GET 'https://api.linkedin.com/v2/organizationalEntityAcls?q=roleAssignee&projection=(elements*(organizationalTarget~))' \
-H 'Authorization: Bearer redacted'
  1. Change the request type from GET to POST.
curl -X POST 'https://api.linkedin.com/v2/organizationalEntityAcls?q=roleAssignee&projection=(elements*(organizationalTarget~))' \
-H 'Authorization: Bearer redacted'
  1. Add the method override header and append the original GET request type.
curl -X POST 'https://api.linkedin.com/v2/organizationalEntityAcls?q=roleAssignee&projection=(elements*(organizationalTarget~))' \
-H 'X-HTTP-Method-Override: GET'
-H 'Authorization: Bearer redacted'
  1. Add the Content-Type header.
curl -X POST 'https://api.linkedin.com/v2/organizationalEntityAcls?q=roleAssignee&projection=(elements*(organizationalTarget~))' \
-H 'X-HTTP-Method-Override: GET'
-H 'Content-Type: application/x-www-form-urlencoded'
-H 'Authorization: Bearer redacted'
  1. Move the query string of the request URL to the request body.
curl -X POST 'https://api.linkedin.com/v2/organizationalEntityAcls' \
-H 'X-HTTP-Method-Override: GET'
-H 'Content-Type: application/x-www-form-urlencoded' 
-H 'Authorization: Bearer redacted'
--data 'q=roleAssignee&projection=(elements*(organizationalTarget~))'

Requests with Body

  1. Change the request type from PUT to POST if the original request type was PUT. If the original request type was POST, keep it as POST.
  2. Add the X-HTTP-Method-Override header using the original HTTP method -H 'X-HTTP-Method-Override: POST' for POSTs or -H 'X-HTTP-Method-Override: PUT' for PUTs.
  3. Add the Content-Type header -H 'Content-Type: multipart/mixed; boundary=xyz'. Note that here we need to specify a boundary delimiter (here we use xyz for illustration) for multipart body, this delimiter needs to be unique and not appearing in your request content body or url.
  4. Move the query string and original request body to body as two sections explained above.

Example

Let’s use the example request below to see how we can quickly convert our existing request to the adCreativesV2 API using query tunneling.

Current Request
curl -X POST 'https://api.linkedin.com/v2/adCreativesV2?ids=List(47770196)' \
-H 'Authorization: Bearer redacted' \
-H 'Content-Type: application/json' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
-H 'X-RestLi-Method:  BATCH_PARTIAL_UPDATE' \
--data '{"entities": {"47770196": {"patch": {"$set": {"status": "ACTIVE"}}}}}'
  1. Change the request type from PUT to POST if the original request type was PUT. If the original request type was POST, keep it as POST.
curl -X POST https://api.linkedin.com/v2/adCreativesV2?ids=List(47770196) \
  -H 'Authorization: Bearer redacted' \
  -H 'X-RestLi-Method: BATCH_PARTIAL_UPDATE' \
  -H 'X-RestLi-Protocol-Version: 2.0.0' \
  --data ${"entities": {{"47770196": {"patch": {"$set": {"status": "ACTIVE"}}}}}}'
  1. Add the X-HTTP-Method-Override header using the original HTTP method -H 'X-HTTP-Method-Override: POST' for POSTs or -H 'X-HTTP-Method-Override: PUT' for PUTs.
curl -X POST https://api.linkedin.com/v2/adCreativesV2?ids=List(47770196) \
  -H 'X-HTTP-Method-Override: POST' \
  -H 'Authorization: Bearer redacted' \
  -H 'X-RestLi-Method: BATCH_PARTIAL_UPDATE' \
  -H 'X-RestLi-Protocol-Version: 2.0.0' \
  --data ${"entities": {{"47770196": {"patch": {"$set": {"status": "ACTIVE"}}}}}}'
  1. Add the Content-Type header -H 'Content-Type: multipart/mixed; boundary=xyz'.
curl -X POST https://api.linkedin.com/v2/adCreativesV2?ids=List(47770196) \
  -H 'X-HTTP-Method-Override: POST' \
  -H 'Content-Type: multipart/mixed; boundary=xyz' \
  -H 'Authorization: Bearer redacted' \
  -H 'X-RestLi-Method: BATCH_PARTIAL_UPDATE' \
  -H 'X-RestLi-Protocol-Version: 2.0.0' \
  --data ${"entities": {{"47770196": {"patch": {"$set": {"status": "ACTIVE"}}}}}}'
  1. Move the query string and original request body to body as two sections.
curl -X POST https://api.linkedin.com/v2/adCreativesV2 \
  -H 'X-HTTP-Method-Override: POST' \
  -H 'Content-Type: multipart/mixed; boundary=xyz' \
  -H 'Authorization: Bearer redacted' \
  -H 'X-Restli-Protocol-Version: 2.0.0' \
  -H 'X-RestLi-Method:  BATCH_PARTIAL_UPDATE' \
  --data $'--xyz\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\nids=List(47770196)\r\n--xyz\r\n 
         Content-Type: application/json\r\n\r\n{"entities": {"47770196": {"patch": {"$set": {"status": "ACTIVE"}}}}}\r\n--xyz--' 

Compliance Sample Use Cases

UGC Posts API

Current request

curl -X GET 'https://api.linkedin.com/v2/ugcPosts?q=authors&authors=List(urn%3Ali%3Aperson%3A123ABC)&sortBy=LAST_MODIFIED&projection=(...)' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0'

New request

curl -X POST 'https://api.linkedin.com/v2/ugcPosts \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
--data 'q=authors&authors=List(urn%3Ali%3Aperson%3A123ABC)&sortBy=LAST_MODIFIED&projection=(...)'

Social Action API

Current request

curl -X GET 'https://api.linkedin.com/v2/socialActions/{shareUrn|ugcPostUrn|commentUrn}/comments?projection=(...)' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0'

New request

curl -X POST 'https://api.linkedin.com/v2/socialActions/{shareUrn|ugcPostUrn|commentUrn}/comments \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
--data 'projection=(...)'

LMS Use Cases

For the full list of Marketing API examples, see Max Request Length Samples for Marketing APIs

Retrieve UGC Posts by Author

Current request

curl -X GET 'https://api.linkedin.com/v2/ugcPosts?q=authors&authors=List(urn%3Ali%3Aorganization%3A2414183)&sortBy=LAST_MODIFIED' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0'

New request

curl -X POST 'https://api.linkedin.com/v2/ugcPosts \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
--data 'q=authors&authors=List(urn%3Ali%3Aorganization%3A2414183)&sortBy=LAST_MODIFIED'

Find Ad Budget Pricing Insights

Current request

curl -X GET 'https://api.linkedin.com/v2/adBudgetPricing?q=criteriaV2&account=urn%3Ali%3AsponsoredAccount%3A123&bidType=CPM&optimizationTargetType=MAX_CLICK&objectiveType=WEBSITE_VISIT&campaignType=SPONSORED_INMAILS&matchType=EXACT&targetingCriteria=(include:(and:List((or:(urn%3Ali%3AadTargetingFacet%3AstaffCountRanges:List(urn%3Ali%3AstaffCountRange%3A%28501%2C1000%29))))))&dailyBudget=(amount:300,currencyCode:USD)' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0'

New request

curl -X POST 'https://api.linkedin.com/v2/adBudgetPricing \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
--data 'q=criteriaV2&account=urn%3Ali%3AsponsoredAccount%3A123&bidType=CPM&optimizationTargetType=MAX_CLICK&objectiveType=WEBSITE_VISIT&campaignType=SPONSORED_INMAILS&matchType=EXACT&targetingCriteria=(include:(and:List((or:(urn%3Ali%3AadTargetingFacet%3AstaffCountRanges:List(urn%3Ali%3AstaffCountRange%3A%28501%2C1000%29))))))&dailyBudget=(amount:300,currencyCode:USD)'

Batch Partial Update Ad Creatives

Current request

curl -X POST 'https://api.linkedin.com/v2/adCreativesV2?ids=List(47770196)' \
-H 'Authorization: Bearer redacted' \
-H 'Content-Type: application/json' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
-H 'X-RestLi-Method:  BATCH_PARTIAL_UPDATE' \
--data '{"entities": {"47770196": {"patch": {"$set": {"status": "ACTIVE"}}}}}'

New request

curl -X POST https://api.linkedin.com/v2/adCreativesV2 \
  -H 'X-HTTP-Method-Override: POST' \
  -H 'Content-Type: multipart/mixed; boundary=xyz' \
  -H 'Authorization: Bearer redacted' \
  -H 'X-Restli-Protocol-Version: 2.0.0' \
  -H 'X-RestLi-Method:  BATCH_PARTIAL_UPDATE' \
  --data $'--xyz\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\nids=List(47770196)\r\n--xyz\r\n 
         Content-Type: application/json\r\n\r\n{"entities": {"47770196": {"patch": {"$set": {"status": "ACTIVE"}}}}}\r\n--xyz--' 

LTS Use Cases

Retrieve Candidate Matches

Current request

curl -L -X GET 'https://api.linkedin.com/v2/atsCandidates?ids[0].atsCandidateId=CAND123&ids[0].dataProvider=ATS&ids[0].integrationContext=urn:li:organization:2414183&ids[1].atsCandidateId=CAND456&ids[1].dataProvider=ATS&ids[1].integrationContext=urn:li:organization:2414183&fields=matchedMembers,manualMatchedMember' \
-H 'Authorization: Bearer redacted' \

New request

curl -L -X POST 'https://api.linkedin.com/v2/atsCandidates' \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
--data 'ids[0].atsCandidateId=CAND123&ids[0].dataProvider=ATS&ids[0].integrationContext=urn:li:organization:2414183&ids[1].atsCandidateId=CAND456&ids[1].dataProvider=ATS&ids[1].integrationContext=urn:li:organization:2414183&fields=matchedMembers,manualMatchedMember’

Sync Candidates

Current request

curl -L -X PUT 'https://api.linkedin.com/v2/atsCandidates?ids[0].atsCandidateId=CAND123&ids[0].dataProvider=ATS&ids[0].integrationContext=urn:li:organization:2414183&ids[1].atsCandidateId=CAND456&ids[1].dataProvider=ATS&ids[1].integrationContext=urn:li:organization:2414183' \
-H 'Content-Type: application/json' \
-H 'x-restli-method: batch_update' \
-H 'Authorization: Bearer redacted' \
--data '{
  "entities": { "atsCandidateId=CAND123&dataProvider=ATS&integrationContext=urn:li:organization:2414183": {
      "addresses": [
        {
          "line1": "31 Spooner St",
          "city": "Quahog",
          "geographicArea": "RI",
          "geographicAreaType": "STATE",
          "postalCode": "02802",
          "country": "us"
        }
      ],
      "atsCreatedAt": 1484864187000,
      "atsLastModifiedAt": 1484864187000,
      "currentCompanyName": "Pawtucket Patriot Brewery",
      "currentJobTitle": "Quality Assurance",
      "emailAddresses": [
        "foo@example.com"
      ],
      "externalProfileUrl": "https://example.com/p-griffin",
      "firstName": "Peter",
      "lastName": "Griffin",
      "middleInitial": "L",
      "phoneNumbers": [
        {
          "number": "555-555-5555",
          "extension": "1234"
        }
      ],
      "prefix": "Mr",
      "suffix": "Jr"
    },
"atsCandidateId=CAND456&dataProvider=ATS&integrationContext=urn:li:organization:2414183": {
      "addresses": [
        {
          "line1": "1000 W Maude Ave",
          "line2": "ATTN: Maude Flanders",
          "city": "Calgary",
          "geographicArea": "AB",
          "geographicAreaType": "PROVINCE",
          "postalCode": "T1X 0L3",
          "country": "ca"
        }
      ],
      "atsCreatedAt": 1484864187000,
      "atsLastModifiedAt": 1484864187000,
      "emailAddresses": [
        "foo@example.com"
      ],
      "externalProfileUrl": "https://example.com/m-flanders",
      "firstName": "Maude",
      "lastName": "Flanders",
      "phoneNumbers": [
        {
          "number": "555-666-7777",
          "extension": "1234"
        }
      ],
      "prefix": "Mrs"
    }
  }
}'

New request

curl -L -X POST 'https://api.linkedin.com/v2/atsCandidates' \
-H 'X-HTTP-Method-Override: PUT' \
-H 'Content-Type: multipart/mixed; boundary=xyz' \
-H 'x-restli-method: batch_update' \
-H 'Authorization: Bearer redacted' \
--data $'--xyz\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\nids[0].atsCandidateId=CAND123&ids[0].dataProvider=ATS&ids[0].integrationContext=urn:li:organization:2414183&ids[1].atsCandidateId=CAND456&ids[1].dataProvider=ATS&ids[1].integrationContext=urn:li:organization:2414183\r\n--xyz\r\n 
Content-Type: application/json\r\n\r\n{
  "entities": {    "atsCandidateId=CAND123&dataProvider=ATS&integrationContext=urn:li:organization:2414183": {
      "addresses": [
        {
          "line1": "31 Spooner St",
          "city": "Quahog",
          "geographicArea": "RI",
          "geographicAreaType": "STATE",
          "postalCode": "02802",
          "country": "us"
        }
      ],
      "atsCreatedAt": 1484864187000,
      "atsLastModifiedAt": 1484864187000,
      "currentCompanyName": "Pawtucket Patriot Brewery",
      "currentJobTitle": "Quality Assurance",
      "emailAddresses": [
        "foo@example.com"
      ],
      "externalProfileUrl": "https://example.com/p-griffin",
      "firstName": "Peter",
      "lastName": "Griffin",
      "middleInitial": "L",
      "phoneNumbers": [
        {
          "number": "555-555-5555",
          "extension": "1234"
        }
      ],
      "prefix": "Mr",
      "suffix": "Jr"
    },
    "atsCandidateId=CAND456&dataProvider=ATS&integrationContext=urn:li:organization:2414183": {
      "addresses": [
        {
          "line1": "1000 W Maude Ave",
          "line2": "ATTN: Maude Flanders",
          "city": "Calgary",
          "geographicArea": "AB",
          "geographicAreaType": "PROVINCE",
          "postalCode": "T1X 0L3",
          "country": "ca"
        }
      ],
      "atsCreatedAt": 1484864187000,
      "atsLastModifiedAt": 1484864187000,
      "emailAddresses": [
        "foo@example.com"
      ],
      "externalProfileUrl": "https://example.com/m-flanders",
      "firstName": "Maude",
      "lastName": "Flanders",
      "phoneNumbers": [
        {
          "number": "555-666-7777",
          "extension": "1234"
        }
      ],
      "prefix": "Mrs"
    }
  }
}\r\n--xyz--'

Check Job Operation Task Status

Current request

curl --location --request GET 'https://api.linkedin.com/v2/simpleJobPostingTasks?ids=urn:li:simpleJobPostingTask:<task_id_1>&ids=urn:li:simpleJobPostingTask:<task_id_2>' \
--header 'Authorization: Bearer <token>' 

New request

curl --location --request POST 'https://api.linkedin.com/v2/simpleJobPostingTasks' \
--header 'Authorization: Bearer {access_token}' \
--header 'X-HTTP-Method-Override: GET' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'ids=urn:li:simpleJobPostingTask:{id}'