With media_id, developers can use this API to download any added permanent asset. The media_id for the permanent asset created by the Official Account in the Media Asset Management module on the Official Accounts Platform can be obtained via the "Get Asset List" API.

Note: Temporary assets cannot be obtained via this API.

# API Request Description

HTTP request method: POST. HTTPS protocol is used.
https://api.weixin.qq.com/cgi-bin/material/get_material?access_token=ACCESS_TOKEN

Calling Example

{
"media_id":MEDIA_ID
}

Call Parameters

Parameter Required Description
access_token Yes The credential for API call
media_id Yes The media_id of the asset to be obtained

# API Response Description

Articles:

{
 "news_item":
 [
     {
     "title":TITLE,
     "thumb_media_id"::THUMB_MEDIA_ID,
     "show_cover_pic":SHOW_COVER_PIC(0/1),
     "author":AUTHOR,
     "digest":DIGEST,
     "content":CONTENT,
     "url":URL,
     "content_source_url":CONTENT_SOURCE_URL
     },
     //A multiple-article broadcast will include information for multiple articles
  ]
}

Video messages:

{
  "title":TITLE,
  "description":DESCRIPTION,
  "down_url":DOWN_URL,
}

For other types of asset messages, the asset content is returned. Developers can save these files. For example:

Example
curl "https://api.weixin.qq.com/cgi-bin/material/get_material?access_token=ACCESS_TOKEN" -d '{"media_id":"61224425"}' > file

Response Parameters

Parameter Description
title The article's title
thumb_media_id The ID for the cover image asset of articles (it must be a permanent mediaID)
show_cover_pic Indicates whether to display the cover. 0 is false, indicating not to display; 1 is true, indicating to display.
author The author
digest The summary of an article. Only the single article has a summary. For multiple articles, it is empty.
content Detailed contents of articles, which supports HTML tags. It must be less than 20,000 characters and 1 MB in size. JS-related content will be removed.
url Article URL
content_source_url The URL to the original page of an article. This is the URL to be redirected to after Read More is tapped.

The returned JSON packet for a failed request (this is an example of invalid media type):

{"errcode":40007,"errmsg":"invalid media_id"}