Add Master Data

Flow for adding master data from UI

Overview

Add Master Data Flow

  • An action button is available on the search master data screen to add master data.

  • Clicking on the action button redirects users to the add master data screen.

  • The Add Master Data screen renders a form through which the user can enter master data.

  • Once the form is submitted, the validations are run as specified in the schema. If the validations are passed, the Create API is called and the respective toast message is shown as relevant to the response received from the Create API.

Role Action Mapping To Access Create API

  • As of now, role actions have to be defined for every schema. Let us take an example of a schema code "Trade.Details"

  • The Create API URL for the above schema will look like this "/mdms-v2/v2/_create/Trade.Details"

  • Hence for this URL, the role action mapping has to be added to the MDMS_ADMIN role.

  • Similarly, for other masters, add role action mapping to the same role "MDMS_ADMIN".

Create Master Data API

Refer to the curl below:

curl 'http://localhost:3000/mdms-v2/v2/_create/Trade.Validations' \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'Accept-Language: en-US,en;q=0.9' \
  -H 'Connection: keep-alive' \
  -H 'Content-Type: application/json;charset=UTF-8' \
  -H 'Origin: http://localhost:3000' \
  -H 'Referer: http://localhost:3000/workbench-ui/employee/workbench/mdms-add-v2?moduleName=Trade&masterName=Validations' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Site: same-origin' \
  -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36' \
  -H 'sec-ch-ua: "Chromium";v="116", "Not)A;Brand";v="24", "Google Chrome";v="116"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Windows"' \
  --data-raw '{"Mdms":{"tenantId":"pb","schemaCode":"Trade.Validations","uniqueIdentifier":null,"data":{"name":"sfd","dropdownField":"90-100"},"isActive":true},"RequestInfo":{"apiId":"Rainmaker","authToken":"5bbfa93c-adc2-42b2-992e-a708a83cb2cf","userInfo":{"id":80234,"uuid":"aeb85b37-c996-4218-bdca-1b00cc268f2f","userName":"WBQA","name":"LOC","mobileNumber":"9999991942","emailId":null,"locale":null,"type":"EMPLOYEE","roles":[{"name":"MDMS ADMIN","code":"MDMS_ADMIN","tenantId":"pb"},{"name":"Super User","code":"SUPERUSER","tenantId":"pb"},{"name":"Localisation admin","code":"LOC_ADMIN","tenantId":"pb"},{"name":"Employee","code":"EMPLOYEE","tenantId":"pb"}],"active":true,"tenantId":"pb","permanentCity":null},"msgId":"1694161641687|en_IN","plainAccessRequest":{}}}' \
  --compressed

Sample request body:

{
    "Mdms": {
        "tenantId": "pb",
        "schemaCode": "Trade.Validations",
        "uniqueIdentifier": null,
        "data": {
            "name": "sfd",
            "dropdownField": "90-100"
        },
        "isActive": true
    },
    "RequestInfo": {
        "apiId": "Rainmaker",
        "authToken": "5bbfa93c-adc2-42b2-992e-a708a83cb2cf",
        "userInfo": {
            "id": 80234,
            "uuid": "aeb85b37-c996-4218-bdca-1b00cc268f2f",
            "userName": "WBQA",
            "name": "LOC",
            "mobileNumber": "9999991942",
            "emailId": null,
            "locale": null,
            "type": "EMPLOYEE",
            "roles": [
                {
                    "name": "MDMS ADMIN",
                    "code": "MDMS_ADMIN",
                    "tenantId": "pb"
                },
                {
                    "name": "Super User",
                    "code": "SUPERUSER",
                    "tenantId": "pb"
                },
                {
                    "name": "Localisation admin",
                    "code": "LOC_ADMIN",
                    "tenantId": "pb"
                },
                {
                    "name": "Employee",
                    "code": "EMPLOYEE",
                    "tenantId": "pb"
                }
            ],
            "active": true,
            "tenantId": "pb",
            "permanentCity": null
        },
        "msgId": "1694161641687|en_IN",
        "plainAccessRequest": {}
    }
}

Last updated

All content on this page by eGov Foundation is licensed under a Creative Commons Attribution 4.0 International License.