Integrate MDMS Service


We will call into MDMS deployed in the sandbox environment. All MDMS config data needs to be uploaded into the MDMS repository (DEV branch if you are deploying/testing in your dev environment).


Integration with MDMS requires the following steps to be followed:

  1. Add a new MDMS file in MDMS repo. For this guide, a sample MDMS file has already been added available here. Copy this file into your repository.

  2. Restart MDMS service after adding the new file via Jenkins build UI.

  3. Once restarted, hit the curl mentioned below to verify that the new file has been properly added .

curl --location --request POST '' \
--header 'Content-Type: application/json' \
--data-raw '{
    "RequestInfo": {
        "apiId": "asset-services",
        "ver": null,
        "ts": null,
        "action": null,
        "did": null,
        "key": null,
        "msgId": "search with from and to values",
        "authToken": "{{devAuth}}"
    "MdmsCriteria": {
        "tenantId": "pb",
        "moduleDetails": [
                "moduleName": "BTR",
                "masterDetails": [
                        "name": "RegistrationCharges"
  1. Call the MDMS service post verification from within our application and fetch the required master data. For this, create a Java class by the name of MdmsUtil under utils folder. Annotate this class with @Component and put the following content in the class -

package digit.utils;

import com.jayway.jsonpath.JsonPath;
import org.egov.common.contract.request.RequestInfo;
import org.egov.mdms.model.MasterDetail;
import org.egov.mdms.model.MdmsCriteria;
import org.egov.mdms.model.MdmsCriteriaReq;
import org.egov.mdms.model.ModuleDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class MdmsUtil {
    private RestTemplate restTemplate;

    private String mdmsHost;

    private String mdmsUrl;

    public Integer fetchRegistrationChargesFromMdms(RequestInfo requestInfo, String tenantId) {
        StringBuilder uri = new StringBuilder();
        MdmsCriteriaReq mdmsCriteriaReq = getMdmsRequestForCategoryList(requestInfo, tenantId);
        Object response = new HashMap<>();
        Integer rate = 0;
        try {
            response = restTemplate.postForObject(uri.toString(), mdmsCriteriaReq, Map.class);
            rate =, "$.MdmsRes.BTR.RegistrationCharges.[0].amount");
        }catch(Exception e) {
            return  null;
        return rate;

    private MdmsCriteriaReq getMdmsRequestForCategoryList(RequestInfo requestInfo, String tenantId) {
        MasterDetail masterDetail = new MasterDetail();
        List<MasterDetail> masterDetailList = new ArrayList<>();

        ModuleDetail moduleDetail = new ModuleDetail();
        List<ModuleDetail> moduleDetailList = new ArrayList<>();

        MdmsCriteria mdmsCriteria = new MdmsCriteria();

        MdmsCriteriaReq mdmsCriteriaReq = new MdmsCriteriaReq();

        return mdmsCriteriaReq;

  1. Add the following properties in file -

#mdms urls # REPLACE with your environment name

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