You can use this API request to change a node from in moderation to published.
/services/v2/node/[nodeId]/publish.json
You can use the following parameters in your publish a node in moderation request:
Other options: wrap, v1
Permissions & Notes:
You must have the Publish other's question permission under Moderation Roles in the Advanced Editor to publish any node in moderation.
- If the node is your own, you must have the Publish questions permission under Standard Roles in the Advanced Editor.
We added this request in version 1.6.3.
Sample Request
A PUT publish a node in moderation request to publish a node (nodeId: 841) in moderation sent to https://apidocs.cloud.answerhub.com using a human-readable Username/Password (answerhub/test123) would look like this:
curl
-u answerhub:test123
-H "Accept: application/json"
-H "Content-type: application/json"
-X PUT "https://apidocs.cloud.answerhub.com/services/v2/node/841/publish.json" -v
Expected Responses
Successful Response:
- HTTP Status 200 - OK
{
"success": true,
"result": {
"publishAction": {
"id": 1076,
"ip": "172.20.0.3",
"user": {
"id": 31,
"username": "demo",
"avatarUrl": "https://secure.gravatar.com/avatar/dd3a67e45fb718ed41fae9155c927ddf?d=identicon&r=PG"
},
"realUser": {
"id": 108,
"username": "admin",
"avatarUrl": "https://secure.gravatar.com/avatar/4e955c70eeff0abe1974c9be300a8887?d=identicon&r=PG"
},
"actionDate": "Wed Feb 06 22:02:40 UTC 2019",
"canceled": false,
"extra": null,
"private": false,
"verb": "published",
"node": {
"id": 841,
"type": "question"
}
}
}
}
Error Response:
If the node is already published or if you are not explicitly granted the required permissions, it returns HTML with permission denied.
<!DOCTYPE html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]>
<html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en">
<![endif]-->
<!--[if IE 7]>
<html class="no-js lt-ie9 lt-ie8" lang="en">
<![endif]-->
<!--[if IE 8]>
<html class="no-js lt-ie9" lang="en">
<![endif]-->
<!-- Consider adding a manifest.appcache: h5bp.com/d/Offline -->
<!--[if gt IE 8]>
<!-->
<html class="no-js" lang="en" xmlns="http://www.w3.org/1999/xhtml">
<!--
<![endif]-->
<head>
<meta charset="utf-8" />
<!-- Use the .htaccess and remove these lines to avoid edge case issues. More info: h5bp.com/i/378 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="Enterprise solution for all your Social Q&A needs." />
<!-- Mobile viewport optimized: h5bp.com/viewport -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Unable to execute your request - apidocs</title>
<script type="text/javascript">
var askFormURL = '/questions/ask.html';
var logoutURL = '/users/logout.html';
var voteUpJsonURL = '/commands/0/voteup.json';
var voteDownJsonURL = '/commands/0/votedown.json';
var getVotesJsonUrl = '/%7Bnode%7D/getVotes.json';
var related_questions_url = '/search.json';
var emailCheckerURL = '/users/temporaryLogin/dupsUserEmailCheck.json';
var authorizedFileTypes = 'xml,gif,png,jpg,jpeg,zip,tar.gz,pdf,txt'.split(",");
var authorizedImageTypes = 'gif,png,jpg,jpeg'.split(",");
var flashMessages = [];
var pageContext = {
currentUser: {
id: '',
username: 'Anonymous',
url: '#',
avatar: '',
reputation: '',
follows: null,
canCreateTopics: false,
haveAlterEgoRole:false
},
i18n: {
confirm: "Are you sure?",
yes: "Yes",
no: "No",
save: "Save Changes",
cancel: "Cancel",
close: "Close",
edit: "Edit",
insert: "Insert",
upload: "Upload",
download: "Download",
choose: "Choose",
deleted: "Deleted",
ok: "Ok",
by: "by",
word: "word",
words: "words",
character: "character",
characters: "characters",
login: "Sign in",
register: "Register",
timeAgo: "{0} ago",
timeAt: "at",
day: "day",
days: "days",
hour: "hour",
hours: "hours",
minute: "minute",
minutes: "minutes",
second: "sec",
seconds: "secs",
justNow: "just now",
retag: "retag",
comment: "Comment",
comments: "Comments",
showOneComment: "
<i class='fa fa-comments-o' aria-hidden='true'></i> Show",
hideOneComment: "
<i class='fa fa-comments' aria-hidden='true'></i> Hide",
showNComments: "
<i class='fa fa-comments-o' aria-hidden='true'></i> Show",
hideNComments: "
<i class='fa fa-comments' aria-hidden='true'></i> Hide",
question: "question",
questions: "Questions",
answer: "Answer",
answers: "Answers",
posts: "Posts",
wiki: "Wiki",
reputation: "Reputation",
unlike: "Unlike",
like: "Like",
likes: "Likes",
favourite: "Save",
unfavourite: "Saved",
follow: "Follow",
unfollow: "Unfollow",
following: "Following",
followers: "Followers",
awarded: "Awarded",
completedBy: "Recently completed by",
joined: "Joined",
authorizedTypes: "Allowed Upload Types",
uploadDialog: {
uploadFile: "Choose a file to upload",
doUpload: "Upload",
fileTooBig: "Your attachment must be $size or smaller.",
invalidAttachmentType: "Your attachment must be one of: xml,gif,png,jpg,jpeg,zip,tar.gz,pdf,txt",
invalidImageType: "Your image must be one of: gif,png,jpg,jpeg"
}...deleted a lot of lines here because too long...
</script>
</body>
</html>