Program-service: wrapper API for open-saber to reduce API calls

Overview

This document is to provide information about the user list API’s request and response.


Problem

To get the user profile details currently three API’s getting called

  • First API calls to get the organization open-saber id by Diksha organization id.

  • The second API call to get the user's open-saber ids which are associate with an organization.

  • The third API call to get the user's profile.

Solution

Write a wrapper function in the program service that will provide user profile details. The wrapper function will take care of calling the needful APIs.

 

POST: program/v1/contributor/search

Request

 

{ "request": { "filters": { "user_org": { "orgId": { "eq": "18180aff-07ba-4f50-bf4a-04ace80f303b" // Org Opensaber id }, "roles": [ "sourcing_reviewer", "sourcing_admin" ] }, "user": { }, }, "fields": [], "limit": 250, "offset": 0 } }

 

Response

{ "id": "api.contributor.search", "ts": "2021-03-10T17:07:23.352Z", "params": { "resmsgid": "14dc4d80-81c3-11eb-bb37-31df32e2bbb0", "msgid": "14dc2670-81c3-11eb-bb37-31df32e2bbb0", "status": "successful", "err": null, "errmsg": null }, "responseCode": "OK", "result": { "contributor": [ { "lastName": null, "tcStatus": null, "maskedPhone": null, "rootOrgName": "15 Aug", "roles": [ "PUBLIC" ], "channel": "15Aug123", "updatedDate": null, "prevUsedPhone": "", "stateValidated": true, "isDeleted": false, "organisations": [ { "updatedBy": null, "organisationId": "013088773085405184115", "orgName": "15 Aug", "addedByName": null, "addedBy": null, "roles": [ "CONTENT_REVIEWER", "PUBLIC" ], "approvedBy": null, "updatedDate": null, "userId": "0f1bd420-8712-48a5-a902-389f697e2339", "approvaldate": null, "isDeleted": false, "parentOrgId": null, "hashTagId": "013088773085405184115", "isRejected": null, "position": null, "id": "013088776329543680162", "orgjoindate": "2020-08-18 11:33:03:158+0000", "isApproved": null, "orgLeftDate": null } ], "managedBy": null, "provider": null, "flagsValue": 6, "maskedEmail": "15*************@yopmail.com", "id": "0f1bd420-8712-48a5-a902-389f697e2339", "tempPassword": null, "recoveryEmail": "", "email": "15*************@yopmail.com", "identifier": "0f1bd420-8712-48a5-a902-389f697e2339", "thumbnail": null, "updatedBy": null, "accesscode": null, "profileSummary": null, "phoneVerified": false, "tcUpdatedDate": null, "locationIds": [], "registryId": null, "recoveryPhone": "", "userName": "15augreviewer45@yopmail.com", "rootOrgId": "013088773085405184115", "userId": "0f1bd420-8712-48a5-a902-389f697e2339", "prevUsedEmail": "", "firstName": "15augreviewer45", "lastLoginTime": null, "emailVerified": true, "tncAcceptedOn": null, "framework": {}, "createdDate": "2020-08-18 11:33:02:904+0000", "phone": "", "createdBy": "95e4942d-cbe8-477d-aebd-ad8e6de4bfc8", "currentLoginTime": null, "userType": "OTHER", "tncAcceptedVersion": null, "status": 1, "name": "15augreviewer45 ", "User": { "lastName": "", "osUpdatedAt": "2020-08-18T13:03:56.272Z", "firstName": "15augreviewer45", "osCreatedAt": "2020-08-18T13:03:56.272Z", "enrolledDate": "2020-08-18T13:03:50.870Z", "@type": "User", "channel": "013088773085405184115", "osid": "17e2ba62-2d73-4944-bfc1-7ade3bbb6ac6", "userId": "0f1bd420-8712-48a5-a902-389f697e2339" }, "User_Org": { "osUpdatedAt": "2020-08-18T13:53:39.765Z", "osCreatedAt": "2020-08-18T13:53:39.765Z", "@type": "User_Org", "roles": [ "user", "sourcing_reviewer" ], "osid": "2eee7982-2eda-42df-8bca-2da9ade69514", "userId": "17e2ba62-2d73-4944-bfc1-7ade3bbb6ac6", "orgId": "18180aff-07ba-4f50-bf4a-04ace80f303b" }, "selectedRole": "sourcing_reviewer" } ], "count": 1 } }