# Publish a draft

Debugging Tools

Interface should be called on the server side, not in the front end (Weixin Mini Program, web pages, APP, etc.) directly called, specific reference interface call guide

Interface name: freepublish_submit

This interface is used to submit a draft of the text for publication.

The developer needs to save the graphic material in the form of a draft and select the draft media_id to publish.

# 1. How to call

# HTTPS calls

POST https://api.weixin.qq.com/cgi-bin/freepublish/submit?access_token=ACCESS_TOKEN

# Cloud Calls

  • This interface does not support cloud calls

# Third party invocation

  • This interface supports Third Party Platform generation business call.

  • The permission set id to which the interface belongs is: 7

  • When a service provider is authorized by one of the permissions set, it can call on behalf of the merchant by using authorizer_access_token , which can be viewed in the third-party call documentation.

# 2. Request parameters

# Query parametersQuery String parameters

Parameter NametypeRequired to fill inIntroductions
access_tokenstringyesInterface invocation credentials, using access_token , authorizer_access_token

# Request BodyRequest Payload

Parameter NametypeRequired to fill inExampleIntroductions
media_idstringyesMEDIA_IDMedia_id of the draft to be published

# 3. Return Parameters

# Response Payload

Parameter NametypeIntroductions
errcodenumberError code
errmsgstringError message
publish_idstringPublish the id of the task
msg_data_idstringData ID of the message

# 4. Note

Note: Normally, when the call succeeds, the errcode will be 0, which only means that the publish task submitted successfully, This does not mean that the release has already been completed at this time, so it is still possible that unusual circumstances may occur during subsequent release processes that cause the release to fail, such as failure of original declarations, failure of platform audits, etc.

# Event push that publishes results

Since a release task may not be completed until a certain time after it is submitted,Thus, when the release interface is called, it only gives a hint of whether the release task was successfully submitted, and if the release task is successfully, the event is pushed to the developer URL (callback URL) that the developer filled out on the public platform at the end of the release task.

Example when the pushed XML structure succeeds:

<xml> 
  <ToUserName><![CDATA[gh_4d00ed8d6399]]></ToUserName>  
  <FromUserName><![CDATA[oV5CrjpxgaGXNHIQigzNlgLTnwic]]></FromUserName>  
  <CreateTime>1481013459</CreateTime>
  <MsgType><![CDATA[event]]></MsgType>
  <Event><![CDATA[PUBLISHJOBFINISH]]></Event>
  <PublishEventInfo>
    <publish_id>2247503051</publish_id>
    <publish_status>0</publish_status>
    <article_id><![CDATA[b5O2OUs25HBxRceL7hfReg-U9QGeq9zQjiDvy
WP4Hq4]]></article_id>
    <article_detail>
      <count>1</count>
      <item>
        <idx>1</idx>
        <article_url><![CDATA[ARTICLE_URL]]></article_url>
      </item>
    </article_detail>
  </PublishEventInfo>
</xml>

Examples when an original review fails:

<xml> 
  <ToUserName><![CDATA[gh_4d00ed8d6399]]></ToUserName>  
  <FromUserName><![CDATA[oV5CrjpxgaGXNHIQigzNlgLTnwic]]></FromUserName>  
  <CreateTime>1481013459</CreateTime>
  <MsgType><![CDATA[event]]></MsgType>
  <Event><![CDATA[PUBLISHJOBFINISH]]></Event>
  <PublishEventInfo>
    <publish_id>2247503051</publish_id>
    <publish_status>2</publish_status>
    <fail_idx>1</fail_idx>
    <fail_idx>2</fail_idx>
  </PublishEventInfo>
</xml>

Return parameter explaination

parameter Introductions
ToUserName Official Account of ghid
FromUserName Official Account openid of group assistant, mphelper
CreateTime The timestamp of the time created
MsgType Message type, in this case event
Event Event information, here for PUBLISHJOBFINISH
publish_id Publish task id
publish_status Release Status, 0: successful, 1: in release, 2: original failure, 3: routine failure, 4: platform failure, 5: user deletion of all articles after successful, 6: system blocking all articles after success
article_id Returns the article_id of the graphic when the publication status is 0 (successful), which can be used in the customer service message scenario
count Returns the number of articles when the post status is 0 (i.e. successful).
idx Returns the number corresponding to the article when the post status is 0 (i.e. successful).
article_url Returns a permanent link to the text when the publishing status is 0 (i.e. successful).
fail_idx When the status of publication is 2 or 4, return the number of articles that did not pass, with 1 for the first article; Other publishing statuses are empty

# 5. Code examples

Example Requests

{
  "media_id": "MEDIA_ID"
}

Return an example

{
  "errcode": 0,
  "errmsg": "ok",
  "publish_id": "100000001"
}

# 6. Error code

The following is a list of error codes for this interface, other error codes can refer to General error codes

Error codeError DescriptionSolutions
0oksuccess
48001api unauthorizedThe API function is not authorized, please confirm that Official Account / Service Account has obtained the interface, you can view the interface permissions in the "public platform website - developer center page"
53503The draft did not pass publication checkCheck the draft information below
53504Go to the official website of the public platform to use the draftGo to the official website of the public platform to use the draft
53505Please save manually successfully before postingPlease go to the public platform's official website to manually save successfully before posting

# 7. Scope of application

How this interface can be invoked under different account types:
Official Account Service Account
Certification only
  • Authentication only: means that only authenticated accounts are allowed to be invoked by the enterprise entity, and accounts that are not authenticated or do not support authentication cannot be invoked.
  • ✔: The account can call this interface
  • Other account types that are not expressly stated may not be called on this interface without special instructions;