Bulk Upload

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
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
  }
}

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
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 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
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
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
  }
}

Sample file

  1. Users Bulk Upload -

  1. Location Bulk Upload -

  1. Organizations Bulk Upload -

Last updated

Was this helpful?