Get Navigation List Interface

Get information about all navigation menus in the system, including the level structure, links, and more.

Points to note

  • The interface uses the GET method and does not require the submission of request body data
  • Access without login is possible
  • Supports retrieval of navigation lists of specified types
  • The result includes hierarchical structure information of navigation
  • Default retrieval of navigation list with type ID 1

Request address

{域名地址}/api/nav/list

Description:{域名地址}Replace it with your domain name, such ashttps://en.anqicms.com/api/nav/list

Request Syntax

GET {域名地址}/api/nav/list

Request Headers

This interface involves only public request headers. For more information, please refer toCommon Request Headers (Common Request Headers).

Request parameters

Field name Type Required Description
type_id int No Navigation type, default is 1

Response header

This interface only involves public response headers. For more information, please refer toCommon Request Headers (Common Request Headers).

Return parameters

Field name Type Description
code int Error code
msg string Error description
data object[] Navigation list data

data result item parameter

Field name Type Description
id int Navigation ID
Title string Navigation Name
sub_title string Secondary Navigation Title
description string Navigation Description
parent_id int Parent Navigation ID
type_id int Navigation type
nav_type int Navigation link type
page_id int Navigation link value
link string Navigation link
sort int Sort Value
status int Status (1: enabled, 0: disabled)
created_time int Timestamp of creation
updated_time int update timestamp
nav_list object[] Sub navigation list

Sub navigation nav_list item parameter

Same as main navigation parameter structure

Usage Example

Request example

GET /api/nav/list HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json

Request example (specify navigation type)

GET /api/nav/list?type_id=1 HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json

Response Example

{
  "code": 0,
  "msg": "",
  "data": [
    {
      "id": 1,
      "created_time": 1611236423,
      "updated_time": 1611236430,
      "title": "博客首页",
      "sub_title": "",
      "description": "",
      "parent_id": 0,
      "nav_type": 0,
      "page_id": 0,
      "type_id": 1,
      "link": "https://en.anqicms.com/",
      "sort": 0,
      "status": 1,
      "nav_list": null
    },
    {
      "id": 4,
      "created_time": 1611236495,
      "updated_time": 1625291595,
      "title": "小程序实战开发",
      "sub_title": "",
      "description": "",
      "parent_id": 0,
      "nav_type": 1,
      "page_id": 3,
      "type_id": 1,
      "link": "https://en.anqicms.com/program",
      "sort": 5,
      "status": 1,
      "nav_list": [
        {
          "id": 7,
          "created_time": 1611795528,
          "updated_time": 1611795640,
          "title": "微信小程序开发",
          "sub_title": "",
          "description": "",
          "parent_id": 4,
          "nav_type": 1,
          "page_id": 5,
          "type_id": 1,
          "link": "https://en.anqicms.com/weapp",
          "sort": 1,
          "status": 1,
          "nav_list": null
        }
      ]
    }
  ]
}

error code

Error code Description
0 OK
-1 Error, the reason is indicated in msg
1001 Not logged in
1002 Not authorized
200 API request OK