+ Start a Discussion
count5count5 

Chatter API LinkPost

I'm developing a C# application to post items to a Chatter Group feed.  I can successfully post a text-only item, but I get an Error 400 trying to post a LinkPost type item.  Can anyone help with an example JSON data block that adds a LinkPost item?  I'm using V24.

Here's some JSON data that is NOT working for me:

{
	"type":"LinkPost",
	"body":{
		"messageSegments":[{
			"type":"text",
			"text":"some text here"
		}]
	},
	"attachment":{
		"title":"some link text",
		"url":"http://www.google.com"
	}
}

 

Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
ChrisOctagonChrisOctagon

Remove the "type" property, it is not supported for feed item inputs. We infer the type based on the attachment object provided. Also, the "title" property should be called "urlName" (sorry).

 

The input and output counterpart objects are not exactly the same. Generally the input objects have less fields because some output fields are calculated automatically based on the values provided in input. The input objects are described in the doc here: http://www.salesforce.com/us/developer/docs/chatterapi/Content/connect_resources_input.htm

All Answers

ChrisOctagonChrisOctagon

Remove the "type" property, it is not supported for feed item inputs. We infer the type based on the attachment object provided. Also, the "title" property should be called "urlName" (sorry).

 

The input and output counterpart objects are not exactly the same. Generally the input objects have less fields because some output fields are calculated automatically based on the values provided in input. The input objects are described in the doc here: http://www.salesforce.com/us/developer/docs/chatterapi/Content/connect_resources_input.htm

This was selected as the best answer
count5count5

Thank you ChisOctagon.  That solved it for me.  You were right - I was trying to the same fields for input that were in the output.