Unable to get nested array of objects from json-server

I am trying to get array of objects from one of the nested JSON properties fields through the json-server , but I am getting 404 error.

When I access the URL in the browser ‘http://localhost:4001/templates/5f105f243c076f3a82c95353’ I get the JSON as mentioned in the db.json , but when I try to access this URL ‘http://localhost:4001/templates/5f105f243c076f3a82c95353/fields’ I am getting 404 error.

I believe from the db.json file, as fields array is a part of template so /fields followed by the base URL of the particular template (http://localhost:4001/templates/5f105f243c076f3a82c95353) should work but it is not working, please help me.

db.json file

{
  "id": "5f105f243c076f3a82c95353",
  "templateIdName": "DNIS Groups",
  "templateDisplayName": "DNIS Groups Template",
  "templateDescription": "Template for DNIS Groups",
  "fieldCounter": 2,
  "fields": [
    {
      "id": 1,
      "fieldIdName": "OutageGroup",
      "fieldDisplayName": "Outage Group",
      "description": "Outage Group",
      "type": "MultiList",
      "values": [
        {
          "listValue": "2803",
          "listDisplay": "Wire Down"
        },
        {
          "listValue": "2804",
          "listDisplay": "Streetlight Outage"
        }
      ],
      "initialValue": "2803",
      "lockValue": "false",
      "requireValue": "true",
      "uniqueField": "true",
      "autoFilter": "false",
      "hideInList": "false",
      "indexField": "true"
    },
    {
      "id": 2,
      "fieldIdName": "ProtectLinesGroups",
      "fieldDisplayName": "Protect Lines Group",
      "description": "Protect Lines Group",
      "type": "MultiList",
      "values": [
        {
          "listValue": "2814",
          "listDisplay": "Cover Lines"
        },
        {
          "listValue": "2815",
          "listDisplay": "Voltage"
        }
      ],
      "initialValue": "2814",
      "lockValue": "false",
      "requireValue": "true",
      "uniqueField": "false",
      "autoFilter": "false",
      "hideInList": "false",
      "indexField": "false"
    }
  ]
}

routes.json file

{
  "/webservice/:clientId/dblookup/template": "/templates",
  "/webservice/:clientid/dblookup/template/:id": "/templates/:id",
  "/webservice/:clientid/dblookup/template/:id/fields": "/templates/:id/fields"
}

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.