POST /articles
 POST /articles.json
556303
def create
      @article = Article.new(params[:article])

      respond_to do |format|
        if @article.save
          format.html { redirect_to edit_category_article_path(@article.category, @article), notice: 'Article was successfully created.' }
          format.json { render json: @article, status: :created, location: @article }
        else
          format.html { render action: "new", :category_id => @article.category, :id => @article }
          format.json { render json: @article.errors, status: :unprocessable_entity }
        end
      end
    end
1226429
def _post_json(path, object_to_post)
      resp = @rawclient.post(url(path), JSON.dump(object_to_post), {'Content-type' => 'application/json'})
      JSON.parse(resp.content)
    end
491859
def empty_articles
      type = params[:format]
      Post.where(:disabled => 'Y', :post_type => type).destroy_all

      redirect_to admin_trash_path, notice: I18n.t("controllers.admin.trash.empty_posts.flash.success", type: type)
    end
993311
def publish
      post_params = {
        :body => {}.to_json,
        :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})
      }

      response = Logan::Client.post "/projects/#{@id}/publish.json", post_params
    end
149207
def help_center_user_articles(self, id, **kwargs):
        ""
        api_path = "/api/v2/help_center/users/{id}/articles.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
677834
def post(path, doc = nil, options = {}, &block)
      execute('POST', path, options, doc, &block)
    end
1046792
def help_center_article_show(self, locale, id, **kwargs):
        ""
        api_path = "/api/v2/help_center/{locale}/articles/{id}.json"
        api_path = api_path.format(locale=locale, id=id)
        return self.call(api_path, **kwargs)
47273
function getArticleByPath(filePath) {
        var article = summary.getByPath(filePath);
        if (!article) return undefined;

        return JSONUtils.encodeSummaryArticle(article);
    }
303097
def post(json_data,
         url,
         dry_run=False):
    

    if dry_run:
        info('POST: %s' % json.dumps(json_data, indent=4))
    else:
        response = SESSION.post(url,
                                data=json.dumps(json_data),
                                headers={'content-type': 'application/json'})

        if response.status_code != 200:
            raise Exception("Failed to import %s with %s: %s" %
                            (json_data, response.status_code, response.text))
32343
def update
      if @comment.update(params.permit(:content))
        render json: @comment
      else
        render json: @comment.errors, status: 422
      end
    end
185774
function insertArticle(summary, article, level) {
    article = SummaryArticle(article);
    level = is.string(level)? level : level.getLevel();

    var parent = summary.getParent(level);
    if (!parent) {
        return summary;
    }

    // Find the index to insert at
    var articles = parent.getArticles();
    var index = getLeafIndex(level);

    // Insert the article at the right index
    articles = articles.insert(index, article);

    // Reindex the level from here
    parent = parent.set('articles', articles);
    parent = indexArticleLevels(parent);

    return mergeAtLevel(summary, parent.getLevel(), parent);
}
591595
public function uploadArticle($articles)
    {
        if ($articles instanceof Article || !empty($articles['title'])) {
            $articles = [$articles];
        }

        $params = ['articles' => array_map(function ($article) {
            if ($article instanceof Article) {
                return $article->transformForJsonRequestWithoutType();
            }

            return $article;
        }, $articles)];

        return $this->httpPostJson('cgi-bin/material/add_news', $params);
    }
537847
def create_post(self, path, **kw):
        """"""
        content = kw.pop('content', None)
        onefile = kw.pop('onefile', False)
        # is_page is not used by create_post as of now.
        kw.pop('is_page', False)
        metadata = {}
        metadata.update(self.default_metadata)
        metadata.update(kw)
        makedirs(os.path.dirname(path))
        if not content.endswith('\n'):
            content += '\n'
        with io.open(path, "w+", encoding="utf8") as fd:
            if onefile:
                fd.write(write_metadata(metadata, comment_wrap=False, site=self.site, compiler=self))
            fd.write(content)
1145176
private function _post($url, &$json)
    {
        curl_setopt($this->_curlHandle, CURLOPT_CUSTOMREQUEST, 'POST');
        return $this->_curlHelper($url, $json);
    }
89314
def post_json(self, uri, data, **kwargs):
        
        encoded_data = json.dumps(data)
        kwargs.setdefault("headers", {}).update({
            "Content-Type": "application/json",  # tell server we are sending json
        })
        return self.post(uri, data=encoded_data, **kwargs)
954722
def post(body, path=nil)
      if header["Content-Type"] =~ /application\/(\w+[+])?json/
         chunk_save(path, "POST", body, param, header)
      else
        execute(
          request(path, :post, body, param, header)
        )
      end
    end
308098
def _post(self, url, data={}):
        """"""
        r = requests.post(self._api_prefix + url,
            data=json.dumps(data),
            headers=self.headers,
            auth=self.auth,
            allow_redirects=False,
        )
        return self._action(r)