Home > CMS Tutorial > Empire CMS > body text

Why can't I use the empire cms universal interface?

下次还敢
Release: 2024-04-16 19:57:27
Original
999 people have browsed it

The empire cms universal interface plug-in outputs the empire cms content to external applications through the public URL and parameter interface. The usage is as follows: install the plug-in and enable it. Configuration interface: Set name permissions Set extended column usage interface: URL format: http://yourwebsite.com/e/api/interface name.php? Parameter 1=value 1¶meter 2=value 2... Parameter: classid (column ID), fields (fields to be obtained), num (number), order (sort), page (current page), pagesize (number of pages per page) Return results: JSON format, including total, page, pagesize, dat

Why can't I use the empire cms universal interface?

Instructions for using the empire cms universal interface

1. What is the empire cms universal interface?

Empire cms universal interface is a plug-in that can output imperial cms content to external applications or platforms. It exposes a URL and parameter interface to facilitate third-party systems to obtain imperial cms content.

2. How to use the empire cms universal interface?

1. Install the plug-in

Download the universal interface plug-in from the imperial cms official website and upload it to the website root directory plugins directory, and then install it in the background plug-in management and enabled.

2. Configure the interface

In the imperial cms background, enter the plug-in management-> universal interface and perform the following configuration:

  • Settings Interface name: Name it arbitrarily, such as "example_api"
  • Interface address: Automatically generated by the system, such as "http://yourwebsite.com/e/api/example_api.php"
  • Permission settings: Select the user group to be allowed to access the interface
  • Extended columns: Select the columns that need to output content through the interface

3. Use the interface

1. URL format

The URL format of the universal interface is:

<code>http://yourwebsite.com/e/api/接口名称.php?参数1=值1&参数2=值2...</code>
Copy after login

For example, to obtain the titles of all articles with column ID 1, the URL is:

<code>http://yourwebsite.com/e/api/example_api.php?classid=1&fields=title</code>
Copy after login

2. Parameter description

  • classid: column ID
  • fields: fields to be obtained, multiple fields separated by commas, such as "title, newstime"
  • num: Number of results returned
  • order: Sorting method, such as "newstime desc"
  • page: Current page number
  • pagesize: Results per page Quantity

3. Return result

Universal interface returns results in JSON format, including the following fields:

  • total: total Number of records
  • page: current page number
  • pagesize: number of results per page
  • data: data array, each element corresponds to one record

For example:

<code class="json">{
  "total": 10,
  "page": 1,
  "pagesize": 10,
  "data": [
    {
      "title": "文章标题1",
      "newstime": "2023-03-08 10:00:00"
    },
    {
      "title": "文章标题2",
      "newstime": "2023-03-09 11:00:00"
    }
  ]
}</code>
Copy after login

The above is the detailed content of Why can't I use the empire cms universal interface?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!