Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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.
Generating an access token
Generate an access token by issuing a POST request to the following endpoint:
POST https://www.linkedin.com/oauth/v2/accessToken
Parameters
Parameter | Description | Required |
---|---|---|
grant_type | The value of this parameter should always be client_credentials. | Yes |
client_id | The client ID obtained by following the steps in Request Access. | Yes |
client_secret | The client secret obtained by following the steps in Request Access. | Yes |
Request
curl -X POST https://www.linkedin.com/oauth/v2/accessToken -d 'grant_type=client_credentials&client_id={client_id}&client_secret={client_secret}' -H 'Content-Type: application/x-www-form-urlencoded'
Response
{
"access_token": "AQXt...",
"expires_in": 7775999
}
Field schema
Field | Description |
---|---|
access_token | The access token that must be included in a request header in each call to LinkedIn Learning APIs. This value must be kept secure. |
expires_in | The number of seconds remaining, from the time it was requested before the token will expire. You can request a new token once your previous token expires. |
Once you have generated an access token, you can start using LinkedIn Learning APIs. See the Making authenticated requests section for how to call the API with the access token.
If you call the LinkedIn Learning API with an invalid access token, you will receive a 401 Unauthorized
error. An access token could be invalid because it has expired or was revoked. When you integrate with the API, it is important to code your application to properly handle 401 Unauthorized
errors. For example, if you receive the error, you can use the client ID and client secret to generate a new access token and retry your request.
Making authenticated requests
Each request to LinkedIn Learning APIs must include a header that contains an access token, generated by following the steps in the Generating an access token section. To include the access token in your request to the API, set an Authorization
header in your request, with the access token in the header value (note the "Bearer" authorization type preceding the access token; this value is required by the authorization protocol):
Request
curl -H 'Authorization: Bearer AQXt…' \
'https://api.linkedin.com/v2/learningAssets?q=criteria&assetFilteringCriteria.keyword=java&fields=urn,title&count=3'
{
"metadata": {
"assetTypeFacetMetadata": [
{
"count": 3000,
"assetType": "VIDEO"
},
{
"count": 116,
"assetType": "COURSE"
},
{
"count": 2,
"assetType": "LEARNING_PATH"
}
],
"difficultyLevelFacetMetadata": [
{
"difficultyLevel": "INTERMEDIATE",
"count": 1427
},
{
"difficultyLevel": "BEGINNER",
"count": 727
},
{
"difficultyLevel": "ADVANCED",
"count": 173
}
]
},
"elements": [
{
"urn": "urn:li:lyndaCourse:669544",
"title": {
"locale": {
"country": "US",
"language": "en"
},
"value": "Learning Java"
}
},
{
"urn": "urn:li:lyndaCourse:375490",
"title": {
"locale": {
"country": "US",
"language": "en"
},
"value": "Java Essential Training for Students"
}
},
{
"urn": "urn:li:lyndaCourse:107061",
"title": {
"locale": {
"country": "US",
"language": "en"
},
"value": "Advanced Java Programming"
}
}
],
"paging": {
"total": 3118,
"count": 3,
"start": 0,
"links": [
{
"rel": "next",
"href": "/v2/learningAssets?assetFilteringCriteria.keyword=java&count=3&q=criteria&start=3",
"type": "application/json"
}
]
}
}