API Foundations

Authentication

LinkedIn Learning APIs use two-legged OAuth 2.0 for access. Two-legged OAuth is also known as OAuth 2.0 application access using the Client Credentials Flow. This flow allows your application to authorize with LinkedIn's API directly - outside the context of any specific user. To generate an access token, you will need a client ID and client secret which can be obtained by following the steps in Request Access.

Foundations Pagination

In order to support retrieval of larger datasets, LinkedIn Learning APIs support pagination on many GET and FINDER endpoints. Paginated responses include a paging object with the fields below:

Response Body Fields

Field Description
total The total number of learning entities matching the requested criteria
count The requested number of learning entities for the page
start The requested start index of learning entities for the page
links An array of link objects. Each link object includes:
  • A "rel" field whose value can be prev or next.
  • An "href" field whose value is the link (relative to the base API URL) for the previous or next page of learning entities matching the requested criteria.
If the previous or next page does not exist, the corresponding link object will be omitted

Sample Response Body


{
  ...
"paging": {
    "total": 5810,
    "count": 20,
    "start": 1000,
    "links": [
      {
        "rel": "prev",
        "href": 
"/v2/learningAssets?assetType=COURSE&count=20&expandDepth=1&includeRetired=false&q=localeAndType&sourceLocale.country=US&sourceLocale.language=en&start=980",
        "type": "application/json"
      },
      {
        "rel": "next",
        "href": 
"/v2/learningAssets?assetType=COURSE&count=20&expandDepth=1&includeRetired=false&q=localeAndType&sourceLocale.country=US&sourceLocale.language=en&start=1020",
        "type": "application/json"
      }
    ]
  }
}

Sample Paged Requests


Here is an example of sequential GET requests used to iterate through 90 active learning assets from the english content library, 30 at a time:

curl -H 'Authorization: Bearer AQXt…' \
'https://api.linkedin.com/v2/learningAssets?assetType=COURSE&count=30&expandDepth=1&includeRetired=false&q=localeAndType&sourceLocale.country=US&sourceLocale.language=en'
curl -H 'Authorization: Bearer AQXt…' \
'https://api.linkedin.com/v2/learningAssets?assetType=COURSE&count=30&start=30&expandDepth=1&includeRetired=false&q=localeAndType&sourceLocale.country=US&sourceLocale.language=en'
curl -H 'Authorization: Bearer AQXt…' \
'https://api.linkedin.com/v2/learningAssets?assetType=COURSE&count=30&start=60&expandDepth=1&includeRetired=false&q=localeAndType&sourceLocale.country=US&sourceLocale.language=en'

About Field Projections

Field projection are a mechanism in LinkedIn Learning APIs that can be used to control how much of an entity's data is included in a response body. When calling any of the API endpoints, you can include a special request parameter that specifies the fields that will be in the response.

Important

If you set the fields parameter when calling an endpoint that retrieves a page of entities, the previous and next links in the paging response (see Pagination) will not include the fields parameter. You will need to add the parameter values to the generated links yourself.

Query Parameters

Field Projection Reference

If you set the "fields" parameter when calling an endpoint that retrieves a page of learning entities, the previous and next links in the paging metadata in the response (see the "Understanding the endpoints" section) will not include the "fields" parameter.

Parameter Description Required
field A list of field projections that specify the fields that will be in the response. You will need to add the same "fields" parameter to the generated links yourself No

Field Projection Syntax

  • field_name to include the entire value of the field.
  • field_name:(sub_field_name) to include only the value of the sub-field if the parent field is an object.
  • field_name:($*:(sub_field_name)) to include only the value of the sub-field if the parent field is an array of objects.

Here are four sample requests showing an example of each kind of field projection:

Parent Field Projection


cURL Request

curl -H 'Authorization: Bearer AQXt…' \
'https://api.linkedin.com/v2/learningAssets?q=criteria&assetFilteringCriteria.keyword=java&fields=title'

Sample Response Body

{
  "elements": [
    {
      "title": {
        "locale": {
          "country": "US",
          "language": "en"
        },
        "value": "Java Essential Training for Students"
      }
    },
    {
      "title": {
        "locale": {
          "country": "US",
          "language": "en"
        },
        "value": "Scala Essential Training"
      }
    },
    ...
  ],
  "metadata": {
    ...
  },
  "paging": {
    ...
  }
}

Child Field Projection


cURL Request

curl -H 'Authorization: Bearer AQXt…' \
'https://api.linkedin.com/v2/learningAssets?q=criteria&assetFilteringCriteria.keyword=java&fields=title:(value)'

Sample Response Body

{
  "elements": [
    {
      "title": {
        "value": "Java Essential Training for Students"
      }
    },
    {
      "title": {
        "value": "Scala Essential Training"
      }
    },
    ...
  ],
  "metadata": {
    ...
  },
  "paging": {
    ...
  }
}

Map with Child Field Projection


cURL Request

curl -H 'Authorization: Bearer AQXt…' \
'https://api.linkedin.com/v2/learningAssets?q=criteria&assetFilteringCriteria.keyword=java&fields=contents:($*:(asset:(urn)))'

Sample Response Body

{
  "elements": [
    {
      "contents": [
        {
          "asset": {
            "urn": "urn:li:lyndaChapter:(urn:li:lyndaCourse:375490,415232)"
          }
        },
        {
          "asset": {
            "urn": "urn:li:lyndaChapter:(urn:li:lyndaCourse:375490,415237)"
          }
        },
      ...
    },
    ...
  ],
  "metadata": {
    ...
  },
  "paging": {
    ...
  }
}

Complex Field Projection


cURL Request

curl -H 'Authorization: Bearer AQXt…' \
'https://api.linkedin.com/v2/learningAssets?q=criteria&assetFilteringCriteria.keyword=java&fields=urn,type,contents:($*:(asset:(urn,type)))'

Sample Response Body

{
  "elements": [
    {
      "urn": "urn:li:lyndaCourse:375490",
      "contents": [
        {
          "asset": {
            "urn": "urn:li:lyndaChapter:(urn:li:lyndaCourse:375490,415232)",
            "type": "CHAPTER"
          }
        },
        {
          "asset": {
            "urn": "urn:li:lyndaChapter:(urn:li:lyndaCourse:375490,415237)",
            "type": "CHAPTER"
          }
        },
        ...
      ],
      "type": "COURSE"
    },
    ...
  ],
  "metadata": {
    ...
  },
  "paging": {
    ...
  }
}

Rate Limiting

Rate limits define the number of calls that can be made in a 24 hour period, beginning at midnight UTC. Rate limiting for the LinkedIn Learning API is enforced on a per application basis. In the event an application exceeds the rate limit for a given API endpoint, the API will return HTTP 429 "Too Many Requests". The following error will be returned in the reponse body:

{ 
"status": 429, 
"serviceErrorCode": 101, 
"message": "Resource level throttle limit for calls to this resource is reached." 
}

The exact number of calls that your application can make per day varies based on the type of request you are making.