Adding a VersionOne expression using the REST API -


i trying create new 'expression' in versionone - adding new 'comment' conversation.

in theory, rest-1.v1/data api should allow this, can't figure out how - there precious little documentation using api (using post) create objects.

fwiw, here's i'm doing (after accessing server valid credentials):

url: /rest-1.v1/data/expression

xml:

<asset href="<server base uri>/rest-1.v1/data/expression"> <attribute name="assettype">expression</attribute> <relation name="inreplyto" /> <attribute name="authoredat">2014-05-28t21:48:37.940</attribute> <attribute name="content">a new comment</attribute> <attribute name="assetstate">64</attribute> <relation name="author">   <asset href="<server base uri>/rest-1.v1/data/member/2015" idref="member:2015" /> </relation> <relation name="belongsto">   <asset href="<server base uri>/rest-1.v1/data/conversation/2018" idref="conversation:2018" /> </relation> <attribute name="author.name">user@example.com</attribute> <attribute name="author.nickname">user name</attribute> <relation name="mentions">   <asset href="<server base uri>/rest-1.v1/data/story/2017" idref="story:2017" /> </relation> </asset> 

i keep getting 400 bad request following error:

<error href="<server base uri>/rest-1.v1/data/expression"> <message>violation'required'attributedefinition'content'expression</message> <exception class="versionone.dataexception"> <message>violation'required'attributedefinition'content'expression</message> </exception> </error> 

i assume i'm missing obvious - know is?

if examine metadata versionone expression, see 3 required fields (author,authoredat,content). logically makes sense able create single, zombie expression witnessed otherwise. might mistake in stylesheet or browser because seems posting 3 return 400 error. guaranteed working payload, include relation "inreplyto" , need create expression within context of particular conversation.

given responding existing expression (comment) should work fine.

post rest-1.v1/data/expression  <asset>   <relation name="author" act="set">      <asset idref="member:2015" />   </relation>    <attribute name="authoredat">2014-05-02t21:48:37.940</attribute>      <attribute name="content" act="set">a new comment</attribute>    <relation name="inreplyto" act="set">      <asset idref="expression:xxxxx" />    </relation> </asset> 

you don't need asset state or mentions or belongs to. assetstate readonly, , belongsto filled in automatically after expression created. inherits reference containing conversation expression object entered in inreplyto field , mentions relation optional.

fyi, believe didn't see legend on right hand side of meta query output seen in browser. real quick here, when meta query, items * required post, bold items read/write optional, italicized items readonly, , bold items towards bottom appended ": operation" operation allow against particular asset.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -