📙
Sunbird Lern
AskDot
  • LEARN
    • Overview
    • Functional Capabilities
    • Technical Architecture
      • Technical Architecture Diagram
      • Tech Stack
    • Dependencies
    • Product Roadmap
  • USE
    • Overview
    • Release Notes
      • Release V 8.0.0 (Ongoing)
      • Release V 7.0.0
      • Release V 5.4.0
      • Release V 5.3.0
      • Release V 5.2.0
      • Release V 5.1.0
      • Release V 5.0.1
      • Release V 5.0.0
      • Release V 4.10.0
      • Release V 4.9.0
      • Release V 4.8.0
      • Release V 4.7.0
    • Developer Guide
      • USER & ORG SERVICE
        • Features/Core capabilities
        • Architecture
          • Code Flow
        • Developer Installation
          • System Requirements
          • Tech Stack
          • Installation Guide
          • Keycloak Local setup
          • Additional Installation Dependencies:
          • Source Code
          • Installation Configuration
        • Data Models
          • Cassandra
            • Data Dictionary
              • User
              • Organisation
              • System Settings
              • Role
              • Bulk Upload Process
              • Tenant Preference
              • Cassandra Migration Version
              • User Consent
              • Email Template
              • OTP
              • Page Management (LMS Service)
              • Location
              • User Notes
              • Deprecated
          • Elastic Search
          • Redis
        • APIs
          • User Management
            • User Deletion API
            • Ownership Transfer API
          • Organisation Management
          • Location Management
          • Consent Management
          • OTP Services
          • Tenant Configurations
          • Bulk Upload
          • System Settings
          • API Management Service
          • Data Sync
          • Notification APIs
        • Flink Jobs
          • User Cache Updater
          • User Deletion Cleanup Flink Job
          • Ownership Transfer Flink Job
        • Reports
          • Standard Exhaust
            • State Admin Geo report
            • State Admin Report
          • Other Jobs
            • User Cache Indexer Job
            • Delete Users Assets Report
          • Data Products Developer Installation
            • System Requirements
            • Tech Stack
            • Installation Dependencies
            • Local installation of data-products
            • Server setup Guide
            • Installation Configuration
            • Data-product creation guide
            • Troubleshooting a data-product
        • Logs, Telemetry Events
        • Configuration
          • Functional Configurations
          • System Settings
          • Email Configuration
          • SMS Configuration
          • OTP based SMS Configuration
        • Roles
          • System Roles
          • User Roles
          • RBAC
        • Dependencies
        • Keycloak on Sunbird
        • How to Guide
          • Create Organization
          • Create User
          • Add new user type & location
        • Single Sign-on with Sunbird
        • Caching and Denormalising User Metadata
          • ETLUserCacheUpdaterJob
          • UserCacheUpdaterFlinkJob
        • Unit Tests and Code Coverage
        • FAQs
      • LMS(BATCH) SERVICE
        • Features/Core Capabilities
        • Architecture
          • Code Flow
        • Developer Installation
          • System Requirements
          • Tech Stack
          • Installation Guide
          • Source Code
        • Data Models
          • Cassandra
            • Data Dictionary
          • ElasticSearch
          • Redis
        • APIs
        • Flink Jobs
          • Merge User Courses
          • Relation Cache Updater
          • Activity Aggregate Updater
          • Assessment Aggregator
          • Enrolment Reconciliation
          • Collection Certificate Pre-Processor
          • Collection Certificate Generator
        • Reports
          • On-Demand Exhaust
            • Response Exhaust
            • User Info Exhaust
            • Progress Exhaust
          • Other Jobs
            • Collection Summary Job
            • Course Batch Status Updater Job
            • Cassandra Migrator Job
            • Score Metric Migration Job
            • Assessment Score Correction Job
            • Collection Reconciliation Job
            • Course Enrollment Job
            • Course Consumption Job
        • Logs, Telemetry Events
        • Configuration
          • System Configuration
          • Functional Configuration
        • Dependencies
        • Certificate Registry and Credentialing using Sunbird-RC
          • Configuring PublicKey in Sunbird-RC
          • Server Setup guide for Sunbird-RC
          • API Guide For Sunbird-RC
        • Certificate Flow
          • Certificates Creation and Configuration
        • FAQs
      • GROUPS
        • Features/Core Capabilities
        • Architecture
          • Code Flow
        • Developer Installation
          • System Requirements
          • Tech Stack
          • Installation Guide
          • Source Code
          • Installation Configuration
        • Data Models
          • Cassandra
            • Data Dictionary
          • Redis
        • APIs
          • Create Group
        • Logs, Telemetry Events
          • UI Telemetry Events
          • Service Telemetry Events
        • Configuration
          • Functional Configurations
        • Design References
        • Dependencies
        • Unit Tests and Code Coverage
      • NOTIFICATION SERVICE
        • Features/Core Capabilities
        • Architecture
          • Code Flow
        • Developer Installation
          • System Requirements
          • Tech Stack
          • Installation Guide
          • Source Code
          • Installation Configuration
        • Data Models
          • Data Dictionary
        • APIs
        • Flink Jobs
        • Logs, Telemetry Events
        • Configuration
          • Functional Configurations
        • Dependencies
        • Unit Tests and Code Coverage
      • DISCUSSION FORUM
        • Features/Core capabilities
        • Architecture
          • Code Flow
        • Developer Installation
          • System Requirements
          • Tech Stack
          • Installation Guide
            • Nodebb setup
            • Discussion Middleware Setup
            • Discussion Middleware
            • Discussion forum integration with any application
            • Discussion-UI setup along with demo application.
            • Sunbird-lern portal for DF
          • Source Code
        • APIs
          • Category APIs
          • User APIs
          • Post APIs
          • Topic APIs
          • Forum APIs
        • Context Schema
        • Configurations
          • Nodebb Admin panel settings
          • Discussion MW & Nodebb System Config
        • Telemetry Events
        • Dependencies
      • ML SERVICE
        • DATA PIPELINE (Flink Jobs)
          • Program User Info
            • Component Diagram
            • Data Model
            • Folder Structure
          • Ml User Delete
            • Component Diagram
            • Data Model
            • Folder Structure
        • DATA PRODUCTS
          • Program Exhaust
            • Component Diagram
            • Folder Structure
    • Server Installation
    • Dependency setup
    • Deprecation
      • Release-5.4.0
    • Jenkins Jobs
    • Release Calendar
    • Learn More
      • Tech References
      • Telemetry Processing
      • Data Dictionary
        • Sample Data
      • Delete User Functionality
      • Asset Ownership Transfer
    • FAQs
  • Engage
    • Discuss
    • Contribute to Sunbird Lern
    • Raise an Issue
    • Contribution Guidelines
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. USE
  2. Developer Guide
  3. USER & ORG SERVICE
  4. APIs

Bulk Upload

PreviousTenant ConfigurationsNextSystem Settings

Last updated 1 year ago

Was this helpful?

Sample file

  1. Users Bulk Upload -

  1. Location Bulk Upload -

  1. Organizations Bulk Upload -

310B
User.bulk.upload.csv
311B
location_bulk_upload.csv
205B
org_bulk_upload.csv
  • POSTUpload Users in Bulk
  • GETCheck Upload Status
  • POSTUpload Location Data in Bulk
  • POSTUpload Organisations in Bulk
  • Sample file

Check Upload Status

get

This API is used to check the upload status

  • The endpoint for Check Upload Status is /data/v1/upload/status/{processId}
  • The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
Path parameters
processIdstringRequired
Header parameters
AcceptstringRequired

(Required) Accept relates to content-Type such as "MIME", Its used in response body for executing different multi purpose operations.Therefore, its important that the server is correctly set up, so that the MIME types transmitted are recognised and correct to determine what action to do when a resource is fetched.

Example: <string>
Content-TypestringRequired

(Required) The Content Type entity is the media type of the resource.Possible media types can be:-

  • Application/json
Example: <string>
AuthorizationstringRequired

(Required) To make use of the API, you require bearerorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here.

Example: {{authorization}}
x-authenticated-user-tokenstringRequired

(Required) It is a unique token/key to authenticate the user each time an API is called. For corresponding sessions this token is used, not your actual username/password

Example: {{user_token}}
Responses
200
OK ! Successful operation." check upload status" operation was successfully executed
application/json
404
- Not Found - The "check upload status" operation failed ! The possible reason for failure is that you may have missed providing input for a mandatory parameter.
application/json
get
GET /api/data/v1/upload/status/{processId} HTTP/1.1
Host: staging.open-sunbird.org
Accept: <string>
Content-Type: <string>
Authorization: {{authorization}}
x-authenticated-user-token: {{user_token}}
{
  "id": "api.upload.status",
  "ver": "v1",
  "ts": "2020-12-01 17:13:43:230+0000",
  "params": {
    "resmsgid": null,
    "msgid": "ff70ec24aae247f1a2b21fae2c200f6c",
    "err": null,
    "status": "success",
    "errmsg": null
  },
  "responseCode": "OK",
  "result": {
    "response": [
      {
        "failureResult": [],
        "processId": 1316326144873267200,
        "successResult": [
          {
            "code": "APDIST1",
            "parentCode": "APCODE",
            "name": "APDIST1",
            "type": "district",
            "parentId": "6824e3d3-5512-4344-a481-7bac011edaa8",
            "id": "333a45f6-ce34-491c-b63b-2187c2df367a",
            "operation": "create"
          },
          {
            "code": "APDIST2",
            "parentCode": "APCODE",
            "name": "APDIST2",
            "type": "district",
            "parentId": "6824e3d3-5512-4344-a481-7bac011edaa8",
            "id": "97287c81-f439-4f69-85fe-d1cf6fca3003",
            "operation": "create"
          }
        ],
        "message": "Operation is completed.",
        "objectType": "location",
        "status": "COMPLETED"
      }
    ]
  }
}

Upload Users in Bulk

post

This API is associated with upload users in bulk on the Sunbird Platform.

  • The endpoint for Upload Users in Bulk is /user/v1/upload
  • The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
Header parameters
AuthorizationstringRequired

(Required) Specify authorization key (format: Bearer api-key) received from administrator when performing given API request.

Example: {{authorization}}
X-Authenticated-User-TokenstringRequired

(Required) Access token of registered user performing given API request.

Content-TypestringRequiredExample: multipart/form-data
Body
userstringRequired

This is a .csv file.

  • Each line of the file is a data record. Each record consists of one or more user fields, separated by commas. Each successfully created user is associated with root org of uploader (org admin).

The CSV file format supported is mentioned below:

  • NAME: Name of user(firstName)
  • MOBILE PHONE: Phone number. Either phone or email is mandatory.
  • EMAIL: Email. Either phone or email is mandatory.
  • SCHOOL ID: Organisation ID to which user must be associated(orgId).
  • USER_TYPE: Type of user. Supported user types are 'teacher' or 'other'.
  • ROLES: List of valid roles for assignment to user on association to an organisation.roles must be in Capital letters
  • USER ID: User ID. Required only in case of user update.
  • External ID: External ID of user. Either, school ID or external ID is mandatory for user association to organisation.
Responses
200
OK ! Successful operation."bulk upload user" operation was successfully executed.
application/json
400
BAD REQUEST. The "bulk upload user" operation failed ! The possible reason for failure is that you may have missed providing input for a mandatory parameter.
application/json
401
Unauthorized
application/json
post
POST /api/user/v1/upload HTTP/1.1
Host: staging.open-sunbird.org
Authorization: {{authorization}}
X-Authenticated-User-Token: text
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 15

"user='text'"
{
  "id": "api.user.upload",
  "ver": "v1",
  "ts": "2020-12-01 16:24:35:250+0000",
  "params": {
    "resmsgid": null,
    "msgid": "bf2d6e695e927a885eaae649c45b84b4",
    "err": null,
    "status": "success",
    "errmsg": null
  },
  "responseCode": "OK",
  "result": {
    "processId": 1316323485186457600
  }
}

Upload Location Data in Bulk

post

This API is used to create a background job for bulk upload of location data into the platform. The upload data is provided in CSV format.

  • The endpoint for Upload Location Data in Bulk is /data/v1/bulk/location/upload
  • The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
Header parameters
AuthorizationstringRequired

(Required) To make use of any Location API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here.

Example: {{authorization}}
x-authenticated-user-tokenstringRequired

(Required) It is a unique token/key to authenticate the user each time an API is called. For corresponding sessions this token is used, not your actual username/password

Example: {{user_token}}
Content-TypestringRequiredExample: multipart/form-data
Body
csvFilestringRequired

CSV file which contains location data in following format:

  • code: 'National level code for state'

  • name: 'Name of entity e.g a state'

  • parentCode: 'code of the parent'

  • parentId : 'ID of the parent (In a hierarchy),

    • if there exists a parent node either parentCode and parentID is required (in case of a child node)
    • if it is highest (top) node in the hierarchy,then no parent details are required
typestringRequired

Represents the information about the possible values of location types state, district, block, cluster

Example: district
Responses
200
OK. Successful operation. The data upload operation is accepted for further processing.
application/json
400
- Bad Request - CLIENT_ERROR. The upload operation failed due to bad request from client. Possible reasons for failure, Mandatory parameter "csvFile" is missing. Maximum upload file size x MB is exceeded. CSV file content is improper.
application/json
post
POST /api/data/v1/bulk/location/upload HTTP/1.1
Host: staging.open-sunbird.org
Authorization: {{authorization}}
x-authenticated-user-token: {{user_token}}
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 36

"csvFile='text'&type='district'"
{
  "id": "api.bulk.location.upload",
  "ver": "v1",
  "ts": "2020-12-01 17:13:28:034+0000",
  "params": {
    "resmsgid": null,
    "msgid": "0eef8c3ff45390894ecd98c146248792",
    "err": null,
    "status": "success",
    "errmsg": null
  },
  "responseCode": "OK",
  "result": {
    "processId": 1316326144873267200
  }
}

Upload Organisations in Bulk

post

This API is associated with bulk uploading organisations on the Sunbird Platform.

  • The endpoint for Upload Organisations in Bulk is /org/v1/upload
  • The fields marked with an asterisk (*) are mandatory. They cannot be null or empty.
Header parameters
AuthorizationstringRequired

(Required) Specify authorization key (format: Bearer api-key) received from administrator when performing given API request.

Example: {{authorization}}
X-Authenticated-User-TokenstringRequired

(Required) Access token of registered user performing given API request.

Example: {{user_token}}
Content-TypestringRequiredExample: multipart/form-data
Body
orgstringRequired

This is a .csv file.

  • Each line of the file is a data record. Each record consists of one or more organisation fields, separated by commas. Each successfully created organisation is associated with root org of uploader (org admin).

The CSV file format supported is mentioned below:

  • SCHOOL NAME: Organisation name(orgName)
  • BLOCK CODE: Location code (locationCode)
  • SCHOOL ID: Organisation ID. Required only in case of organisation update(organisationId).
  • EXTERNAL ID: External ID of organisation(externalId)
  • STATUS: Status. Supported values are 'active' and 'inactive'(status) mandatory param.
  • DESCRIPTION: Organisation description(description)
Responses
200
OK ! Successful operation."bulk org upload " operation was successfully executed.
application/json
400
- Bad Request. The "bulk org upload " operation failed ! The possible reason for failure is that you may have missed providing input for a mandatory parameter.
application/json
post
POST /api/org/v1/upload HTTP/1.1
Host: staging.open-sunbird.org
Authorization: {{authorization}}
X-Authenticated-User-Token: {{user_token}}
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 14

"org='text'"
{
  "id": "api.org.upload",
  "ver": "v1",
  "ts": "2020-12-04 06:51:24:413+0000",
  "params": {
    "resmsgid": null,
    "msgid": "54f533acafefddb758704fb75caad1f9",
    "err": null,
    "status": "success",
    "errmsg": null
  },
  "responseCode": "OK",
  "result": {
    "processId": 131650814782423040
  }
}