Content API - POST - Documentation topics on: contentletapi,.

This documentation is a static copy for this version. For current documentation, see:

Content API - POST

Here is an example of a form that will perform a simple post and simple redirect upon posting the content.

<script type="text/javascript" >
    $(document).ready(function() {
    $("#webup").submit(function(e) {
      var dataObj= {
      'title': $('#title').val(),
      'body': $('#body').val(),
      'contentHost': '',
      'stName': 'webPageContent'
          url: '/api/content/save/1',
          type: 'POST',
          cache: false,
          data: dataObj,
          beforeSend: function (request){
          // This sends the user who authenticates against the dotCMS server
          // In a real world example, you could use session based authentication
          request.setRequestHeader("DOTAUTH", window.btoa(""));
        success: function(data,status,xhr) {
          window.location = "";
        error: function(data,status,xhr) {
          alert("fail: " + data);
<form id="webup">
    <div class="form-group">
    <label for="title" class="required">Title</label>
    <input type="text" class="form-control" id="title" name="title" value="Here is a title">
    <div class="form-group">
    <label for="body" class="required">Body</label>
    <textarea id="body" name="body" >Here is some texttest</textarea>
    <div class="form-group">
      <input type="submit" value="Give 'er a go" />