Skip to content

Creating users

kochhar edited this page Apr 29, 2018 · 1 revision

Create org

Request

curl -X POST \
  https://demo.open-sunbird.org/api/org/v1/create \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI0YTI3YWI1ZmJlN2Q0MTMyOWFhMzVkZjIzZjY4NTdkYyJ9.BiUL61oK1XKQx-wJpCLqw17AgY9HRlLFMfGPLuCYkfI' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -H 'X-Authenticated-User-Token: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJpRzdwN3hmQ3RKcnZMLXc4ZDdoZ0d2aTg4M2tQTFVmM1l5Y0FtSHgtNjdjIn0.eyJqdGkiOiIyNmU5Mjg3OS1mMGM5LTRhYjQtYTFiYy00MTg4ZmEzOTllOTgiLCJleHAiOjE1MjUwMDI1ODcsIm5iZiI6MCwiaWF0IjoxNTI0OTgwOTg3LCJpc3MiOiJodHRwczovL2RlbW8ub3Blbi1zdW5iaXJkLm9yZy9hdXRoL3JlYWxtcy9zdW5iaXJkIiwiYXVkIjoiYWRtaW4tY2xpIiwic3ViIjoiMDRmMTViYjAtNTMwYy00Mzg0LWFiZDItNDc1YjIyMzc1NjlkIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiYWRtaW4tY2xpIiwiYXV0aF90aW1lIjowLCJzZXNzaW9uX3N0YXRlIjoiZGRkZmEwZmMtZWY1OS00ZjlhLWE5NzAtNTUzODA2YzVlYWM2IiwiYWNyIjoiMSIsImFsbG93ZWQtb3JpZ2lucyI6W10sInJlc291cmNlX2FjY2VzcyI6e30sIm5hbWUiOiJkZW1vLXVzZXIgcmV2aWV3ZXJfMDRfb3JnXzAwMSIsInByZWZlcnJlZF91c2VybmFtZSI6ImRlbW8tdXNlciIsImdpdmVuX25hbWUiOiJkZW1vLXVzZXIiLCJmYW1pbHlfbmFtZSI6InJldmlld2VyXzA0X29yZ18wMDEifQ.ZYEu2lb8nZVCaFnCV1zbEwCnc6GaE3zH24cuE-8iDVReo2heTQuiYzGCjcZpsUjTL0dLCZfsRnPl_NUrRPxwHw-cJ6ZQG1QP4hWI1TG9LYrJZdrl2OuiDXbELuI4DQlE6dybdsvmGJ9y1MZRZL1XYbJ3r37h8Y3mMXLk9Oy6b2Qb9joZ5RxBJ3JVhVAyeQzOpK2kbxcM_yG9cCMh23kyavHMa9QRwRC5SxFvAKl-VhCznGVAUlnTCmHBkNf5poDlgbvV7ZSvhm_Vw6XDFSujOQzo_MAsO6y5RSQ98gb1_1jEda7GQSp8MRZiAQ6UaDxIZx8Sh2vlQAO2ZcF4ZdPvnA' \
  -d '{
    "request": {
	"orgName": "Sunbird Demo Org",
	"description": "Organisation for Sunbird demonstration purpose",
	"channel": "sunbird",
	"isRootOrg": true
    }
  }
  '

Response

{
    "id": "api.org.create",
    "ver": "v1",
    "ts": "2018-04-25 04:53:48:361+0000",
    "params": {
        "resmsgid": null,
        "msgid": "9cd58fe3-c8ac-449d-8c9f-ebc7b214bb02",
        "err": null,
        "status": "success",
        "errmsg": null
    },
    "responseCode": "OK",
    "result": {
        "organisationId": "01248978630926336015",
        "response": "SUCCESS"
    }
}

Create user

Request

curl -X POST \
  https://demo.open-sunbird.org/api/user/v1/create \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI0YTI3YWI1ZmJlN2Q0MTMyOWFhMzVkZjIzZjY4NTdkYyJ9.BiUL61oK1XKQx-wJpCLqw17AgY9HRlLFMfGPLuCYkfI' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -d '{
  "request": {
    "firstName": "Administrator",
    "lastName": null,
    "userName": "org-admin2",
    "email": "[email protected]",
    "rootOrgId": "01248978630926336015"
  }
}'

Response

{
    "id": "api.user.create",
    "ver": "v1",
    "ts": "2018-04-25 04:56:48:642+0000",
    "params": {
        "resmsgid": null,
        "msgid": null,
        "err": null,
        "status": "success",
        "errmsg": null
    },
    "responseCode": "OK",
    "result": {
        "response": "SUCCESS",
        "accessToken": null,
        "userId": "b82f9ca6-1f95-4069-9acb-36ec3b34e41b"
    }
}

Add user to org

Request

curl -X POST \
  https://demo.open-sunbird.org/api/org/v1/member/add \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI0YTI3YWI1ZmJlN2Q0MTMyOWFhMzVkZjIzZjY4NTdkYyJ9.BiUL61oK1XKQx-wJpCLqw17AgY9HRlLFMfGPLuCYkfI' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -H 'X-Authenticated-User-Token: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJpRzdwN3hmQ3RKcnZMLXc4ZDdoZ0d2aTg4M2tQTFVmM1l5Y0FtSHgtNjdjIn0.eyJqdGkiOiIyNmU5Mjg3OS1mMGM5LTRhYjQtYTFiYy00MTg4ZmEzOTllOTgiLCJleHAiOjE1MjUwMDI1ODcsIm5iZiI6MCwiaWF0IjoxNTI0OTgwOTg3LCJpc3MiOiJodHRwczovL2RlbW8ub3Blbi1zdW5iaXJkLm9yZy9hdXRoL3JlYWxtcy9zdW5iaXJkIiwiYXVkIjoiYWRtaW4tY2xpIiwic3ViIjoiMDRmMTViYjAtNTMwYy00Mzg0LWFiZDItNDc1YjIyMzc1NjlkIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiYWRtaW4tY2xpIiwiYXV0aF90aW1lIjowLCJzZXNzaW9uX3N0YXRlIjoiZGRkZmEwZmMtZWY1OS00ZjlhLWE5NzAtNTUzODA2YzVlYWM2IiwiYWNyIjoiMSIsImFsbG93ZWQtb3JpZ2lucyI6W10sInJlc291cmNlX2FjY2VzcyI6e30sIm5hbWUiOiJkZW1vLXVzZXIgcmV2aWV3ZXJfMDRfb3JnXzAwMSIsInByZWZlcnJlZF91c2VybmFtZSI6ImRlbW8tdXNlciIsImdpdmVuX25hbWUiOiJkZW1vLXVzZXIiLCJmYW1pbHlfbmFtZSI6InJldmlld2VyXzA0X29yZ18wMDEifQ.ZYEu2lb8nZVCaFnCV1zbEwCnc6GaE3zH24cuE-8iDVReo2heTQuiYzGCjcZpsUjTL0dLCZfsRnPl_NUrRPxwHw-cJ6ZQG1QP4hWI1TG9LYrJZdrl2OuiDXbELuI4DQlE6dybdsvmGJ9y1MZRZL1XYbJ3r37h8Y3mMXLk9Oy6b2Qb9joZ5RxBJ3JVhVAyeQzOpK2kbxcM_yG9cCMh23kyavHMa9QRwRC5SxFvAKl-VhCznGVAUlnTCmHBkNf5poDlgbvV7ZSvhm_Vw6XDFSujOQzo_MAsO6y5RSQ98gb1_1jEda7GQSp8MRZiAQ6UaDxIZx8Sh2vlQAO2ZcF4ZdPvnA' \
  -d '{
	"request": {
		"organisationId": "01248978630926336015",
		"roles": ["ORG_ADMIN"],
		"userId": "b82f9ca6-1f95-4069-9acb-36ec3b34e41b"
	}
}
'

Response

{
    "id": "api.org.member.add",
    "ver": "v1",
    "ts": "2018-04-25 10:19:45:518+0000",
    "params": {
        "resmsgid": null,
        "msgid": null,
        "err": null,
        "status": "success",
        "errmsg": null
    },
    "responseCode": "OK",
    "result": {
        "response": "SUCCESS"
    }
}

Search Users

curl -X POST \
  https://demo.open-sunbird.org/api/user/v1/search \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI0YTI3YWI1ZmJlN2Q0MTMyOWFhMzVkZjIzZjY4NTdkYyJ9.BiUL61oK1XKQx-wJpCLqw17AgY9HRlLFMfGPLuCYkfI' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -H 'x-authenticated-user-token: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJpRzdwN3hmQ3RKcnZMLXc4ZDdoZ0d2aTg4M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		"filters": {
		},
		"limit": 500
	}
}
'

Response

{
    "id": "api.user.search",
    "ver": "v1",
    "ts": "2018-04-29 05:49:49:740+0000",
    "params": {
        "resmsgid": null,
        "msgid": "0e019c45-f66b-4b65-a272-7a94272da85f",
        "err": null,
        "status": "success",
        "errmsg": null
    },
    "responseCode": "OK",
    "result": {
        "response": {
            "count": 6,
            "content": [
                { ... truncated ... },
                { ... truncated ... },
                {
                    "lastName": null,
                    "webPages": [],
                    "tcStatus": null,
                    "education": [],
                    "gender": null,
                    "regOrgId": null,
                    "subject": [],
                    "roles": [
                        "PUBLIC"
                    ],
                    "language": [],
                    "updatedDate": null,
                    "skills": [],
                    "isDeleted": null,
                    "organisations": [
                        {
                            "orgJoinDate": "2018-04-25 10:19:45:238+0000",
                            "organisationId": "01248978630926336015",
                            "approvalDate": "2018-04-25 10:19:45:238+0000",
                            "isDeleted": false,
                            "addedByName": "XzXMgp2Jc4rmL4xRsyqaAEroTCxGdZH86jpIQWLpa1OGKcuEqCGovcA4eZgdY7nLXHQxJ92Dx1jp\nzVHOjoGtFgmcCidudWZKWBaXCLvMOakE1bJDcLWm/PCuKsDOTj9DTQtMGOn7lhkDdxs1iV8l8A==",
                            "addedBy": "04f15bb0-530c-4384-abd2-475b2237569d",
                            "roles": [
                                "ORG_ADMIN"
                            ],
                            "approvedBy": "04f15bb0-530c-4384-abd2-475b2237569d",
                            "isRejected": false,
                            "id": "01248995067289600020",
                            "isApproved": true,
                            "userId": "b82f9ca6-1f95-4069-9acb-36ec3b34e41b"
                        }
                    ],
                    "provider": null,
                    "countryCode": null,
                    "id": "b82f9ca6-1f95-4069-9acb-36ec3b34e41b",
                    "tempPassword": null,
                    "email": "",
                    "identifier": "b82f9ca6-1f95-4069-9acb-36ec3b34e41b",
                    "thumbnail": null,
                    "updatedBy": null,
                    "address": [],
                    "jobProfile": [],
                    "profileSummary": null,
                    "tcUpdatedDate": null,
                    "avatar": null,
                    "rootOrgId": "ORG_001",
                    "emailVerified": false,
                    "firstName": "Administrator",
                    "lastLoginTime": null,
                    "createdDate": "2018-04-25 04:56:48:586+0000",
                    "createdBy": "",
                    "phone": null,
                    "dob": null,
                    "grade": [],
                    "currentLoginTime": null,
                    "location": null,
                    "status": 1
                },
                { ... truncated ... },
                { ... truncated ... },
                { ... truncated ... },
            ]
        }
    }
}
Clone this wiki locally