URI

<newsInfos_uri>/{id}[.<format>]

Supported Methods

GET, PUT, HEAD

Parent Resource

newsInfos

Description

The newsInfo resource represents the information of a single news item. It supports getting the details of a single news item and updating a single news item.

Supported Methods:

  • GET: Get the details of a news item.
  • PUT: Update a news item.
  • HEAD: Check whether the newsInfo resource exists or whether the permissions allow access to the newsInfo resource.

Supported output formats: RJSON, JSON, XML.

Resource hierarchy

HTTP Request Methods

Perform HTTP requests on the following URI. The rjson output format is used as an example, where supermapiportal is the server name.

http://supermapiportal:8190/iportal/web/news/{id}.rjson

GET Request

Get the basic information of the news item specified by the ID.

Response Structure

Perform a GET request on the newsInfo resource. The returned resource representation structure is as follows:

Field Type Description
thumbnail String The thumbnail of the news.
visitCount Integer The visit count of the news.
createTime Long The news creation time.
updateTime Long The news update time.
id Integer The unique identifier of the news.
source String The news source.
published Boolean Whether the news has been published.
title String The news title.
category String The category of the news.
userName String The creator of the news.
content String The content of the news.
nickname String The nickname of the news creator.

Response Example

Perform a GET request on the newsInfo resource: http://localhost:8190/iportal/web/news/928867994.rjson. The rjson format response is as follows:

{

  "thumbnail": null,

  "visitCount": 8,

  "createTime": 1600064805362,

  "nickname": "admin",

  "updateTime": 1600064805362,

  "id": 928867994,

  "source": "Planning Department",

  "published": true,

  "title": "Meeting Notice",

  "category": null,

  "userName": "admin",

  "content": "Department meeting will be held at 3:00 PM on September 15 in Conference Room 1. Please attend on time."

}

PUT Request

Update the details of the news item specified by the ID.

Request Parameters

When sending a request, the following parameters must be included in the request body:

Name Type Description
thumbnail String The thumbnail of the news.
source String The news source.
published Boolean Whether the news has been published.
title String The news title.
category String The category of the news.
content String The content of the news.

Response Structure

The returned resource representation structure is as follows:

Field Type Description
succeed boolean Whether the news update was successful.
error HttpError Error information. This field is not returned if the news update is successful.

Response Example

Perform a PUT request on the newsInfo resource: http://localhost:8190/iportal/web/news/928867994.rjson to update the news title from "Meeting Notice" to "Meeting Notice No.2". The request body is as follows:

{

    "thumbnail": null,

    "source": "Planning Department",

    "published": true,

    "title": "Meeting Notice No.2",

    "category": null,

    "content": "Department meeting will be held at 3:00 PM on September 15 in Conference Room 1. Please attend on time."

}

The rjson format response is as follows:

{"succeed": true}

HEAD Request

Returns the same HTTP response headers as the GET request, but without the response entity. Metadata information contained in the response headers can be retrieved without transferring the entire response content. Metadata information includes media type, character encoding, compression encoding, entity content length, etc.

A HEAD request can be used to check whether the newsInfo resource exists or whether the client has permission to access the newsInfo resource. By performing a HEAD request on the URI with .<format> appended, you can also quickly determine whether the newsInfo resource supports the <format> format representation.

See