Skip to content

API User Manual

Dev URLs

https://dev-portal.drecs.org

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.

Create ACL Module Form

Here, In our below page we can also view the listing of created/existing ACL Modules.

Listing of ACL Module Name Form

After adding acl module crudl name, admin can also manage Role (OrganizationAdmin, DeviceOwner, Buyer, SubBuyer, User) base permission.

Add Permission Form

Here, We can have listing of user role permissions.

alt text

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,

User Registration Form

If User register for ApiUser role then after registration done ApiUser will get private key file downloaded.

fie download notification

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.

Private key pem file

After successful registration of apiuser, will be redirected to permission request form.

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.

Listing of requested permission

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.

All Api Users

After clicking permission status admin will move apiuser permission in ui as “inactive” and “active”.

Listing of permission requests of apiuser at admin

and from the ”update status” button, admin can change status.

Update permission status form

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.

Listing of permissions

Step4. ApiUser workflow

Organization

Create User Organization (Developer and Buyer) from ui apiuser can create organization for developer and buyer from add organization form.

Add Organization Form1

Add Organization Form2

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.

All Users Form

Api users can see all added organization list from “All organization” menu item in the left hand navigation..

All Organization

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.

Add Device Form

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.

Device Listing

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.

Device Bulk Upload Form

And see the job of bulk upload process

Listing of Bulk Upload Job

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.

Add Reads Form1

After selecting organization, the UI will show all required field for read

Add Reads Form2

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.

Listing of Meter Read

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”.

Permission Update Form

but status will be ’inactive” which can be made active by super admin.

listing of permission request form

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.

Add Reservation Form

After clicking submit button, an popup will appear to choose “yes” or “no” and after clicking “continue”, the reservation will be done.

Confirm form at Add reservation

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.

My Reservation listing

From the “action button” apiuser will be able to check all certificates of the particular reservation.

All Certificate listing of an reservation

Certificate

Apiuser can check all certificates by the reservation base and device base by selecting type of organization (developer or buyer).

Certificate Listing

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

Register ApiUser Payload

Register ApiUser Response

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.

Register ApiUser Payload

Response:

Register ApiUser 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:

Forget Password Form

Response:

Forget Password Response Form

Developer or Buyer under an apiuser is unauthorized to access this api.

Dev or Buyer Forget Password payload

Dev or Buyer Forget Password Response

ME API

Request Type: GET

Request URL: http://localhost:3040/api/user/me

ACL Module Name: Not Required

Authorization: Required

Bearer Authorization Form

Permission: Not Required

Headers: Not Required

Request Body: No body payload required

Response:

User/me Response Form

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:

Resend Confirm mail Response

CONFIRM-EMAIL API

Request Type: PUT

Request URL: http://localhost:3040/api/user/confirm-email/a3a7b310f3fecb245a16ce4643d4600a965d637156c17a84a1360223173079f41401ad5689213dd41f8036b671d7c8386aec7af29f8aab3a076008f3c2b962f3

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:

Resend Confirm mail Response

RESET PASSWORD API

Request Type: PUT

Request URL: http://localhost:3040/api/user/confirm-email/a3a7b310f3fecb245a16ce4643d4600a965d637156c17a84a1360223173079f41401ad5689213dd41f8036b671d7c8386aec7af29f8aab3a076008f3c2b962f3

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.

Reset Password Payload

Response:

Reset Password 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:

Login Api Payload

Response:

Login Api Response

Developer and Buyer of an apiuser is unauthorized to aceess this api.

Login Api Payload for Dev or Buyer

Login Api Response for Dev or Buyer

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:

ApiUser Permission Request Form

Response:

Permission Request 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.

Device Register Payload

Response:

Device Register Response

It will throw unauthorized exception when give buyer’s organizationId in payload.

Device Register Payload with Buyer's OrgId

Device Register Response for with Buyer's OrgId

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.

Get Device By Id Payload

Request Body: Not required

Response:

Get Device By Id 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.

Query Params Get My Devices Payload1

Query Params Get My Devices Payload2

Request Body: Not required

Response: Response when given the page number only. Returns the array of devices with pagination.

Get My Device Response1

Response when given the page number and organizationId . Returns the array of devices with pagination.

Get My Device Response2

Response when buyer’s organizationId given.

Get My Device Response for Buyers

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

Bearer Authorization Form

URLarams: This organization Id in url params should be the developer’s organizationId.

Request Body: Required

Add Device Bulk Upload Payload

Response:

If developer’s organizationId given

Bulk Upload Dev Response1

If buyer’s organizationId given

Bulk Upload Buyer Response2

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

Bearer Authorization Form

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:

Get UnGrouped Devices 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

Bearer Authorization Token

URL Params: The id in URL params is the developer external id of the device for which we want to add meter read.

Add Reads URL Params

Request Body: Required

Add Meter Reads Payload

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

Request URL: http://localhost:3040/api/meter-reads/new/Ext1?readType=meterReads&start=2023-01-01T00:00:00Z&end=2023-11-26T07:32:59Z&pagenumber=2&organizationId=15

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.

Get Meter Reads URL Param1

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.

Get Meter Reads URL Param2

Request Body: Not required.

Response: If the buyer’s organizationId

Get Meter Reads Response1

Get Meter Reads Response1.1

If the developer’s organizationId is given

Get Meter Reads Response2

Get Meter Reads Response2.2

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

Bearer Authorization Form

Query Params:

The organizationId in query params can be given both developer’s and buyer’s.

Request Body: Required.

Invite api payload

Response:

If the buyer’s and developer’s organizationId

Invite api Response

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

Bearer Authorization Form

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,

Get Invitation Response1

If the Developer’s organizationId given

Get Invitation Response2

If the buyer’s organizationId is given

Get Invitation Response3

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

Bearer Authorization Form

Query Params:

The buyer’s organizationId in query params can be given.

Request Body: Required.

Create reservation Payload

Response:

If the Developer’s organizationId given, will throw unauthorized error.

If the buyer’s organizationId is given

Create Reservation Response

GET RESERVATION API

Request Type: GET

Request URL: http://localhost:3040/api/buyer-reservation?apiuserId=37110d08-e1af-4909-88c9-3f57025a7965&organizationId=26&pageNumber=1&limit=3

ACL Module Name: Required. BUYER_RESERVATION_MANAGEMENT_CRUDL

Permission: Read permission required

Headers: Not Required

Authorization: Required

Bearer Authorization Form

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.

Get Reservation Response1

If apiuserId and organizationId given, It also filter the response by organization.

Get Reservation Response2

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

Bearer Authorization Form

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:

Get Reservation By Id Response

BULK UPLOAD JOBS API

Request Type: GET

Request URL: http://localhost:3040/api/buyer-reservation/bulk-upload/get-all-csv-jobs-of-organization?orgId=25&pageNumber=1&limit=1

ACL Module Name: Required. DEVICE_BULK_MANAGEMENT_CRUDL

Permission: Read permission required

Headers: Not Required

Authorization: Required

Bearer Authorization Form

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

Bearer Authorization

Query Params:

OrganizationId in query param is given organization of developer.

Request Body: Not Required.

Response:

Get Bulk Upload Api

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

Bearer Authorization Form

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:

Get Certificate Log Response1

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

Bearer Authorization

Query Params:

Page number in query param is to request which page we want to view.

Request Body: Not Required.

Response:

Get Issuer/certified Response

Built with VitePress ❤️.