API User Manual
Dev URLs
Swagger UI:
https://dev-api.drecs.org/swagger
Stage URLs
D-REC Origin:
https://stage-portal.drecs.org/
Swagger UI:
https://stage-api.drecs.org/swagger/
DREC API User Manual - UI
Step 1. Admin create
The super admin will be created by default when the migrations running in our api end.
Step 2. After Admin login, admin can create or use existing ACLModule name with crdul permission
1. Migration update:
The ACL Module names also will be create by default during migration running in our api end.
2. Migration update with UI:
The ACL Module name can created through our UI as shown below.
Here, In our below page we can also view the listing of created/existing ACL Modules.
After adding acl module crudl name, admin can also manage Role (OrganizationAdmin, DeviceOwner, Buyer, SubBuyer, User) base permission.
Here, We can have listing of user role permissions.
Step 3. User registration process (user can add be two type)
Direct Drec User- User can register directly by using role as Developer or Buyer,
If User register for ApiUser role then after registration done ApiUser will get private key file downloaded.
Below is the pem private key using which we will authorize the request from apiuser's application.This pem key file is the one time downloadable file which is very confidential. Apiuser was instructed to keep the private key file as confidential.
After successful registration of apiuser, will be redirected to permission request form.
In this for apiuser need to make a request to be able to use all module apis (like some apiuser only use Developer module or some apiuser will use Buyer module or else some will use both module). After submiting, apiuser will get status of permission in permission list ui.
After apiuser sends permission request, they have to wait for “approve” status of permission. admin can approve apiuser permissions. admin will check apiuser permission status form all apiuser list.
After clicking permission status admin will move apiuser permission in ui as “inactive” and “active”.
and from the ”update status” button, admin can change status.
After admin change status, apiuser will get changed status in own side then after, they will be able to use drec functionality according to permission aprroved.
Step4. ApiUser workflow
Organization
Create User Organization (Developer and Buyer) from ui apiuser can create organization for developer and buyer from add organization form.
and submit form and redirect to list view.
After adding user apiuser will get all user of own organization and can view in “all users” page.
Api users can see all added organization list from “All organization” menu item in the left hand navigation..
They can also see organization by using filter by organization name.
Device
Device working process
Apiuser can create the devices. There is an organization name dropdown to filter the devices in which will get the listings of developer's organization name who is registered under the logged in apiuser. They first need to select the organization name, then after fill all required device related information.
after submitting device form, they will be redirect Device list view.
To see all Device of all organization which belongs to apiuser. When we want to filter devices we will have the organization name dropdown to filter the devices in which will get the listings of developer's organization name who is registered under the logged in apiuser.
Apiuser can also add devices in bulk form using bulk upload. Apiuser can create the devices. There is an organization name dropdown to filter the devices in which will get the listings of developer's organization name who is registered under the logged in apiuser. They first need to select the organization name of an developer who is registered under this apiuser then we can upload the file.
And see the job of bulk upload process
Read
Apiuser Meter read working process
To add meter read, they First need to select organization of developer for whose devices we need to add reads.
After selecting organization, the UI will show all required field for read
Apiuser also gets meter read list of all organization devices which belong their platform. When we want to filter meter reads we will have the organization name dropdown which will get the listings of developer's organization name who is registered under the logged in apiuser.
Permission
apiuser can view update permission from permission menu
If apiuser after getting “approved” permission from admin side in a module and they want to again update some permission in the same module, so they will be able to update by using “edit form”.
but status will be ’inactive” which can be made active by super admin.
AddReaservaion
Apiuser can make reservation from “add reservation” menu,
To make a reservation apiuser needs to first select an organization name of buyer's which is registered under the same logged in apiuser and then after he fills in all required fields in the form and can select devices from ungrouped devices list which are not a part of any other reservation.
After clicking submit button, an popup will appear to choose “yes” or “no” and after clicking “continue”, the reservation will be done.
then after they will be redirected to “ my reservation list”. When we want to filter devices we will have the organization name dropdown to filter the devices in which will get the listings of buyer's organization name who is registered under the logged in apiuser.
From the “action button” apiuser will be able to check all certificates of the particular reservation.
Certificate
Apiuser can check all certificates by the reservation base and device base by selecting type of organization (developer or buyer).
DREC API User Manual - API
User Module
Register Api
Request Type: POST
Request URL: http://localhost:3040/api/user/register
Authorization: Not Required
ACL Module Name: USER_MANAGEMENT_CRUDL
Organization Type - ApiUser
Permission: Not Required (It’s true by default).
Headers: Not Required
Organization Type - Developer/Buyer under an ApiUser
Permission: Write permission required. (Need to login (Ref: 2.1) and Request permission for this ACL module Name (Ref: 3.1))
Headers: Not Required
Request Body: We have to pass the ‘api_user_id' of ApiUser under whom registering the Developer/ Buyer’s organization.
Response:
FORGET-PASSWORD API
Request Type: POST
Request URL: http://localhost:3040/api/user/forget-password
ACL Module Name: PASSWORD_MANAGEMENT_CRUDL
Permission: Write permission required
Headers: Not Required
Authorization: Not required
Request Body:
Response:
Developer or Buyer under an apiuser is unauthorized to access this api.
ME API
Request Type: GET
Request URL: http://localhost:3040/api/user/me
ACL Module Name: Not Required
Authorization: Required
Permission: Not Required
Headers: Not Required
Request Body: No body payload required
Response:
RESEND CONFIRM MAIL API
Request Type: PUT
Request URL: http://localhost:3040/api/user/resend-confirm-email
ACL Module Name: Required. USER_MANAGEMENT_CRUDL
Permission: Write permission required Headers: Not Required
Authorization: Required
Request Body: Not required
Response:
CONFIRM-EMAIL API
Request Type: PUT
ACL Module Name: Required. USER_MANAGEMENT_CRUDL
Permission: Write permission required Headers: Not Required
Authorization: Not Required
URL params: token is the string that we receive through mail
Request Body: Not required
Response:
RESET PASSWORD API
Request Type: PUT
ACL Module Name: Required. USER_MANAGEMENT_CRUDL
Permission: Write permission required Headers: Not Required
Authorization: Not Required
URL params: token is the string that we receive through mail
Request Body: Required.
Response:
Auth Module
LOGIN API
Request Type: POST
Request URL: http://localhost:3040/api/auth/login
ACL Module Name: Not Required
Permission: Not Required
Headers: Not Required
Request Body:
Response:
Developer and Buyer of an apiuser is unauthorized to aceess this api.
Permission Module
REQUEST PERMISSION API
Request Type: POST
Request URL: http://localhost:3040/api/permission/module/apiuser/request
ACL Module Name: Not Required
Permission: Not Required
Headers: Not Required
Authorization: Required
Request Body:
Response:
Device Module
REGISTER DEVICE API
Request Type: POST
Request URL: http://localhost:3040/api/device
ACL Module Name: Required. DEVICE_MANAGEMENT_CRUDL
Permission: Write permission required
Headers: Not Required
Authorization: Required
Request Body:
The organizationID in this payload is applicable only for ApiUser. This organizationId value should be Developer’s organization Id who wants to register a device in our application.
Response:
It will throw unauthorized exception when give buyer’s organizationId in payload.
GET DEVICE BY ID API
Request Type: GET
Request URL: http://localhost:3040/api/device/10?organizationId=10&apiUserId=958c05ec-feac-48b7-ba10-6fcd76d9b122
ACL Module Name: Required. DEVICE_MANAGEMENT_CRUDL
Permission: Read permission required
Headers: Not Required
Authorization: Required
Query Params: This organization Id and apiUserId in query params should be same as the device’s apiuserId and organizationId.
Request Body: Not required
Response:
GET MY DEVICES API
Request Type: GET
Request URL: http://localhost:3040/api/device/my?organizationId=25&pagenumber=1
ACL Module Name: Required. DEVICE_MANAGEMENT_CRUDL
Permission: Read permission required
Headers: Not Required
Authorization: Required
Query Params: This organization Id in query params is applicable for ApiUser and It is optional. When the organizationId is not provided, it will get response of all devices of developers of this apiuser. When the organizationId is given, it will get the response of all devices of organization and developers of this apiuser.
If buyer’s organizationId provided will receive the unauthorized exception.
PageNumber in query param is mandatory for apiuser.
Request Body: Not required
Response: Response when given the page number only. Returns the array of devices with pagination.
Response when given the page number and organizationId . Returns the array of devices with pagination.
Response when buyer’s organizationId given.
CREATE DEVICES BY BULK UPLOAD API
Request Type: POST
Request URL: http://localhost:3040/api/device/addByAdmin/process-creation-bulk-devices-csv/21
ACL Module Name: Required. DEVICE_BULK_MANAGEMENT_CRUDL
Permission: Write permission required
Headers: Not Required
Authorization: Required
URLarams: This organization Id in url params should be the developer’s organizationId.
Request Body: Required
Response:
If developer’s organizationId given
If buyer’s organizationId given
GET UNGROUPED DEVICES API
Request Type: GET
Request URL: http://localhost:3040/api/device/ungrouped/buyerreservation?pagenumber=1&organizationId=26
ACL Module Name: Required. DEVICE_MANAGEMENT_CRUDL
Permission: Read permission required
Headers: Not Required
Authorization: Required
Query Params:
OrganizationId in query param is given buyer’s organization.
Page Number in query param is given to retrieve the page you want to view.
Request Body: Not Required.
Response:
Reads Module
ADD METER READS API
Request Type: POST
Request URL: http://localhost:3040/api/meter-reads/new/Ext1
ACL Module Name: Required. READS_MANAGEMENT_CRUDL
Permission: Read permission required
Headers: Not Required
Authorization: Required
URL Params: The id in URL params is the developer external id of the device for which we want to add meter read.
Request Body: Required
Response: No response. Read will be added in db when the developer’s organizationId given in the body payload.
If the buyer’s organizationId in body payload is given, the unauthorized exception will be thrown.
GET METER READS BY EXTERNAL ID API
Request Type: GET
ACL Module Name: Required. READS_MANAGEMENT_CRUDL
Permission: Read permission required
Headers: Not Required
Authorization: Required
Query Params: The organizationId in query params can be given both developer’s and buyer’s.
URL Params: If the developers organizationId given in query params, the id in URL params is the developer external id of the device for which we want to get meter read.
If the buyer’s organizationId given in query params, the id in URL params is the device id of which we want to get meter read.
Request Body: Not required.
Response: If the buyer’s organizationId
If the developer’s organizationId is given
INVITATION MODULE
INVITE API
Request Type: POST
Request URL: http://localhost:3040/api/invitation?organizationId=3
ACL Module Name: Required. INVITATION_MANAGEMENT_CRUDL
Permission: Write permission required
Headers: Not Required
Authorization: Required
Query Params:
The organizationId in query params can be given both developer’s and buyer’s.
Request Body: Required.
Response:
If the buyer’s and developer’s organizationId
GET INVITATION API
Request Type: GET
Request URL: http://localhost:3040/api/invitation?organizationId&pageNumber&limit
ACL Module Name: Required. INVITATION_MANAGEMENT_CRUDL
Permission: Read permission required
Headers: Not Required
Authorization: Required
Query Params:
The organizationId in query params can be given to both developer’s and buyers.
The Page Number and limit to be provided for pagination.
Request Body: Not Required.
Response:
If there is no organizationId given,
If the Developer’s organizationId given
If the buyer’s organizationId is given
BUYER-RESERVATION MODULE
RESERVATION API
Request Type: POST
Request URL: http://localhost:3040/api/buyer-reservation?orgId=26
ACL Module Name: Required. BUYER_RESERVATION_MANAGEMENT_CRUDL
Permission: Write permission required
Headers: Not Required
Authorization: Required
Query Params:
The buyer’s organizationId in query params can be given.
Request Body: Required.
Response:
If the Developer’s organizationId given, will throw unauthorized error.
If the buyer’s organizationId is given
GET RESERVATION API
Request Type: GET
ACL Module Name: Required. BUYER_RESERVATION_MANAGEMENT_CRUDL
Permission: Read permission required
Headers: Not Required
Authorization: Required
Query Params:
The apiuserId in query param is for admin to view the reservations by apiuser. If apiuser provides the apiuser , it should be same as his own apiuserId.
OrganizationId in query param is given reservations can be filtered by organization of the same apiuser.
Page number in query param is 1 by default.
Limit in query param is to provide the number items to be viewed per page.
Request Body: Not Required.
Response:
If apiuserId only given will get the response of array of reservations by apiuserId.
If apiuserId and organizationId given, It also filter the response by organization.
GET RESERVATION BY ID API
Request Type: GET
Request URL: http://localhost:3040/api/buyer-reservation/41?organizationId=26
ACL Module Name: Required. BUYER_RESERVATION_MANAGEMENT_CRUDL
Permission: Read permission required
Headers: Not Required
Authorization: Required
Query Params:
OrganizationId in query param is given organization of reservation.
URL Param:
The url param id is the reservationId that you want to retrieve.
Request Body: Not Required.
Response:
BULK UPLOAD JOBS API
Request Type: GET
ACL Module Name: Required. DEVICE_BULK_MANAGEMENT_CRUDL
Permission: Read permission required
Headers: Not Required
Authorization: Required
Query Params:
OrganizationId in query param is given organization of developer.
Page number in query param is to request which page we want to view, and its default value is 1.
Limit is the number of items to be viewed per page.
Request Body: Not Required.
Response:
GET BULK UPLOAD STATUS API
Request Type: GET
Request URL: http://localhost:3040/api/buyer-reservation/bulk-upload-status/48?orgId=25
ACL Module Name: Required. DEVICE_BULK_MANAGEMENT_CRUDL
Permission: Read permission required
Headers: Not Required
Authorization: Required
Query Params:
OrganizationId in query param is given organization of developer.
Request Body: Not Required.
Response:
CERTIFICATE LOG MODULE
CERTIFICATE LOG API
Request Type: GET
Request URL: http://localhost:3040/api/certificate-log/issuer/certifiedlogOfdevices?pageNumber=1&organizationId=26
ACL Module Name: Required. CERTIFICATE_LOG_MANAGEMENT_CRUDL
Permission: Read permission required
Headers: Not Required
Authorization: Required
Query Params:
OrganizationId in query param is given organization of reservation.
Page number in query param is to request which page we want to view.
Request Body: Not Required.
Response:
ISSUER CERTIFIED API
Request Type: GET
Request URL: http://localhost:3040/api/certificate-log/issuer/certified/new/3ea3d485-6920-4632-9c7f-a6ac8566b1bd?pageNumber=1
ACL Module Name: Required. CERTIFICATE_LOG_MANAGEMENT_CRUDL
Permission: Read permission required
Headers: Not Required
Authorization: Required
Query Params:
Page number in query param is to request which page we want to view.
Request Body: Not Required.
Response: