Migrating from the Catalog REST API
Step-by-step guide to migrating from the legacy REST Catalog endpoint to the new GraphQL API.
Quick summary
X-Auth-Token → Authorization: Token
Was in URL path → now embedded in token scope.
snake_case → camelCase
Integer minutes → ISO8601 string (e.g., P30D).
Not available in REST → included in GraphQL response.
All fields returned → request only what you need.
Update endpoint and authentication
Generate API credentials in Manage Web. Your token will automatically include the COMPANY:<companyId> scope.
curl -H "X-Auth-Token: YOUR_TOKEN" \
https://api.udacity.com/api/emc/companies/123/catalogcurl -X POST https://api.udacity.com/api/public/api/v1/catalog/graphql \
-H "Content-Type: application/json" \
-H "Authorization: Token YOUR_API_KEY" \
-d '{
"query": "{ catalog { companyId programs { key title type summary duration imageUrl redirectUrl syllabusUrl modifiedDate } } }"
}'Field names & duration format
Field name changes (snake_case → camelCase)
Duration format change
Breaking Change: Duration changed from integer minutes to ISO8601 duration strings.
P30D= 30 daysP1Y2M= 1 year, 2 monthsPT2H30M= 2 hours, 30 minutes
{ "duration": 102240, "duration_type": "minutes" }{ "duration": "P71D" }Update response parsing
GraphQL wraps results in data.catalog. Access programs via response.data.catalog.programs.
New fields in GraphQL
Program version number (new).
Program locale (new).
SSO deep links by contract (new).
Assessment catalog — not available in REST (new).
{
"programs": [
{
"key": "nd124-ent",
"title": "Google AdWords Enterprise",
"type": "DEGREE",
"duration": 102240,
"duration_type": "minutes",
"image_url": "https://..."
}
]
}{
"data": {
"catalog": {
"companyId": "123",
"programs": [
{
"key": "nd124-ent",
"title": "Google AdWords Enterprise",
"type": "DEGREE",
"duration": "P71D",
"imageUrl": "https://...",
"version": 1,
"locale": "en-us"
}
],
"assessments": [ ... ]
}
}
}Migration checklist
- Generate API credentials in Manage Web
- Update auth header:
X-Auth-Token→Authorization: Token - Change HTTP method:
GET→POST - Update endpoint to
https://api.udacity.com/api/public/api/v1/catalog/graphql - Add request body with GraphQL query as JSON
- Add
Content-Type: application/jsonheader - Update field names: all
snake_case→camelCase - Handle duration format: integer minutes → ISO8601
- Update response parsing: access via
response.data.catalog - Check for
errorsarray in responses - Test in Playground