LogoLogo
  • LEARN
    • Overview
    • Capabilities
      • Rich and Diverse Assets
      • Organised Collections
      • Asset Lifecycle Management
      • Powerful Discovery
      • Phygital Discovery
      • Observability
    • Technical Architecture
    • Product & Developer Guide
      • Content Service
        • Content APIs
          • Features
          • Architecture
          • Code Structure
          • Schemas
          • APIs
          • Jobs
            • Content publish
            • Asset enrichment
            • Audit event generator
            • Video stream generator
          • FAQs
            • Upload Content
        • Media APIs
          • Features
          • Architecture
          • Schemas
          • APIs
          • Jobs
            • Asset enrichment
            • Audit event generator
          • FAQs
        • Channel APIs
          • Architecture
          • Schema
          • APIs
          • Configuration
          • FAQs
        • License APIs
          • Architecture
          • Schema
          • APIs
          • Configuration
          • FAQs
        • Collection APIs
          • Features
          • Architecture
          • Schemas
          • APIs
          • Jobs
            • Content publish
            • Post publish processor
            • Audit event generator
          • FAQs
      • Search Service
        • Architecture
        • Code Structure
          • Configuration
        • APIs
        • Jobs
          • Search indexer
          • Audit history indexer
        • FAQs
      • Taxonomy Service (Taxonomy & Tagging)
        • Framework APIs
          • Architecture
          • Code Structure
            • Configuration
          • Schemas
          • APIs
          • Jobs
            • Audit event generator
          • FAQs
            • Create Framework
            • Add Content to Framework
        • Object Category APIs
          • Architecture
          • Code Structure
          • Schemas
          • APIs
          • Jobs
            • Audit event generator
          • Configuration
          • FAQs
      • DIAL Service
        • Architecture
        • APIs
        • Jobs
        • Configuration
        • FAQs
          • Link DIAL Code to a Book
      • Player
        • V1
          • Features
          • Architecture
          • Players
            • ECML Player - v1
              • Quiz
              • Create Content
            • Video Player v1
            • Epub Player - v1
            • PDF Player - v1
            • HTML-h5p Player - v1
          • Content import and preview folder creation
          • FAQs
        • V2
          • PDF Player
            • Features
            • Architecture
            • Configuration
            • FAQ's
          • Epub Player
            • Features
            • Architecture
            • Configuration
            • FAQ's
          • Video Player
            • Features
            • Architecture
            • Configuration
            • FAQ's
        • Telemetry Events
          • Offline Telemetry
          • Generate API keys
      • Editors
        • Architecture
        • Interactive Editor
          • Features
            • Content Editor
            • Adding Question Set
            • Concept Selector
            • Add Image
            • Add Video
            • Adding Math Function
            • Limited Publishing and Sharing
        • File Upload Editor
          • Features
          • FAQ's
            • Content Upload
        • Collection Editor - V1
        • Collection Editor - V2
          • Features
          • Architecture
          • APIs
          • FAQ's
        • How to contribute as a JS plugin
          • How do I think about a plugin?
          • Interactive Editor Plugin Guide
          • Using SDK to create and test the plugin
      • Other Knowlg Jobs
        • Configuration
        • FAQs
      • Other
        • Data Migration
        • Schema strucure
    • Product Roadmap
  • ENGAGE
    • Discuss
    • Contribute to SB Knowlg
  • USE
    • Overview
    • System requirements
    • Installation guide
      • Players
        • V1
          • How to setup
        • V2
          • Epub Player
          • Video Player
          • Pdf Player
      • Editors
        • Interactive Editor
        • File Upload Editor
        • Collection Editor - V1
        • Collection Editor - V2
        • Plugins
      • Services
        • Content Service
          • Configuration
        • Search Service
        • Taxonomy Service (Taxonomy & Tagging)
        • DIAL Service
        • Knowlg Jobs
    • Deployment
    • Release notes
      • Release - 6.2.0 (Ongoing)
      • Release - 6.1.0 (latest)
      • Release - 6.0.0
      • Release - 5.7.0
      • Release - 5.6.0
      • Release - 5.5.0
      • Release - 5.4.0
      • Release - 5.3.0
      • Release - 5.2.0
      • Release - 5.1.0
      • Release - 5.0.0
      • Release - 4.10.0
      • Release - 4.8.0
    • Breaking Changes
    • Deprecations
      • Release-5.2.0
      • Release-5.1.0
    • Release
    • USE
      • Infra Requirements
    • Additional Reading
      • Content Service Environment Variables
      • Import External Content
  • Archived
    • Powerful Discovery
      • Usecase
      • Sample data
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. LEARN
  2. Product & Developer Guide
  3. Player
  4. Telemetry Events

Generate API keys

Generate API key

This document explains the procedure to generate API keys for a user. It is mandatory to get the API keys for Sunbird server installation. To begin the process of generating the API keys, ssh login to the server where the Sunbird admin util docker container is running.

Create Consumer

POST http://localhost:4000/v1/consumer/create

  1. Use a port on which adminutil container is running. By default port is 4000.

Request Body

username={username} // Unique & unmodifiable name of the consumer add in curl request & call below request

  {
    "id": "sunbird.api.consumer.create",
    "ver": "1.0",
    "ets": 1538296140,
    "params": {
        "msgid": ""
    }, 
    "request": {
        "username": "" //username={username} // Unique & unmodifiable consumer name 
    }
}

Response Body

  {
    "id": "ekstep.api.consumer.create",
    "ver": "1.0",
    "ets": 1489054878488,
    "params": {
        status: "",
        err: "",
        errmsg: "",
        msgid: "",
        resmsgid: "",
    }
    "result": {
        key: "", //the key generated to uniquely identify the consumer
        secret: "" //secret for signing the token.
        username: "",
    }
}
  1. Generate the JWT token using the key and secret and key return in above request.

Error codes

  • INTERNAL_ERROR: Unknown/Unhandled error (equivalent HTTP 500)

  • CONSUMER_GET_ERROR: Error when getting existing consumer

  • GROUP_ASSIGN_ERROR: Error when assigning consumer to default group

  • CREATE_CREDENTIAL_ERROR: Error when creating credential

  • BAD_REQUEST: Invalid request. Following are the reasons for this error

    • JSON is not parsable

    • mandatory fields missing (username)

    • username has space

    • username is of type UUID (Due to Kong limitation, username cannot be UUID)

Add Groups to Consumer

  1. Each API have whitelisted acl groups. The consumer who have access to these group can consume a particular API.

For example: To read a content consumer should have access to contentUser group.

  1. API’s and groups attached to API documented here.

Attaching consumer to group(s) groups={list-of-group-names}

POST http://localhost:4000/v1/consumer//grant

Request Body

  {
"id": "sunbird.api.consumer.grant",
"ver": "1.0",
"ets": 1489054878488,
"params": {
    "msgid": ""
}, 
"request": {
    "groups": ["contentUser", "contentAdmin"] // ACL Groups
}
}

Response Body

  {
"id": "ekstep.api.consumer.grant",
"ver": "1.0",
"ets": 1489054878488
"params": {
    status: "",
    err: "",
    errmsg: "",
    msgid: "",
    resmsgid: "",
},
"result": {
    groups: ["contentUser", "contentAdmin"],
    username: "" //Name of the consumer used for granting the access
}
}

Get Consumer Details

POST http://localhost:4000/v1/consumer//read

Request Body

  {
"id": "ekstep.api.consumer.read",
"ver": "1.0",
"ets": 1489054878488,
"params": {
    "msgid": ""
    }
}

Response Body

  {
"id": "ekstep.api.consumer.read",
"ver": "1.0",
"ets": 1489054878488
"params": {
    status: "",
    err: "",
    errmsg: "",
    msgid: "",
    resmsgid: "",
    },
"result": {
    username: "",
    groups: ["contentUser", "contentAdmin"]
    }
}

Delete Consumer

POST http://localhost:4000/v1/consumer/{consumer_name}/delete

Request Body

  {
"id": "ekstep.api.consumer.delete",
"ver": "1.0",
"ets": 1489054878488
"params": {
    msgid: "",
    }
}

Response Body

  {
"id": "ekstep.api.consumer.read",
"ver": "1.0",
"ets": 1489054878488
"params": {
    status: "",
    err: "",
    errmsg: "",
    msgid: "",
    resmsgid: "",
    }
}

Deprecate a Credential

This utility API is required for managing the credential. Using this api a credential for a consumer will be deprecated. After which the credential can’t be used for any API call except credential rotation.

POST http://localhost:4000/v1/consumer/credential/deprecate

Request Body

  {
"id": "ekstep.api.consumer.credential.deprecate",
"ver": "1.0",
"ets": 1489054878488
"params": {
    msgid: "",
    }, 
"request": {
    "key": "" // key of the credential to be deprecated
    }
}

Response Body

  {
"id": "ekstep.api.consumer.credential.deprecate",
"ver": "1.0",
"ets": 1489054878488
"params": {
    status: "",
    err: "",
    errmsg: "",
    msgid: "",
    resmsgid: "",
    }
}

PreviousOffline TelemetryNextEditors

Last updated 2 years ago

Was this helpful?