1

I want to POST method request for Office365 using REST API. For example, Feed/Post, Post/Reply, and Post/Like.

Request Header:

Accept : application/json; odata=verbose

Content-Type: application/json; odata=verbose

Method: POST

ContentLength: content.Length

CookieContainer: cookieContainer

Request content about Feed/Post

"restCreationData":
 {
  "__metadata":{
        "type":"SP.Social.SocialRestPostCreationData"
      },
  "ID":null,
  "creationData":{
        "__metadata":{
          "type":"SP.Social.SocialPostCreationData"
        },
        "ContentText":"This post was published using REST.", 
        "UpdateStatusText":false
  }
}

But I get 403 status error.

Can anyone tell me How to post method request for Office365.

  • Are you doing this operation from a SharePoint App? If yes, you will have to give your App the Permissions to access the Social Feed. You can do that from the AppManifest.xml – Vardhaman Deshpande Jan 25 '14 at 7:30
0

Try this:

jQuery.ajax({
        url: "http://<site url>/_api/web/lists/GetByTitle('Test')",
        type: "POST",
        data: JSON.stringify({ '__metadata': { 'type': 'SP.List' }, 'Title': 'New title' }),
        headers: { 
            "X-HTTP-Method":"MERGE",
            "accept": "application/json;odata=verbose",
            "content-type": "application/json;odata=verbose",
            "content-length": <length of post body>,
            "X-RequestDigest": $("#__REQUESTDIGEST").val(),
            "IF-MATCH": "*"
        },
        success: doSuccess,
        error: doError
});

Reference: Writing data by using the REST interface

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.