Andrew,

answers inline ...

On Sun, Oct 16, 2011 at 5:54 AM, andrew ton <[email protected]> wrote:
> 1. Set property: the section 16.5.1 describes that the 
> url http://localhost:7474/db/data/node/5/properties/foo and the body to be 
> put is "bar". I assume "foo" is the property name and bar the property value. 
> But how is the string "bar" sent in the PUT request while the service accepts 
> a JSON object (Content-type = application/json)?
> I have tried to put a string or a json object like {"value":"testing"}. I got 
> Bad request error as I anticipated.
Looking at 
http://docs.neo4j.org/chunked/snapshot/rest-api-node-properties.html#rest-api-set-property-on-node
you can set the property as just a string in the request, which is
valid JSON. I have added to the test to check that after multiple
property sets the old ones are still there, see
https://github.com/neo4j/community/blob/master/server/src/functionaltest/java/org/neo4j/server/rest/SetNodePropertiesFunctionalTest.java#L99

This should make sure that you can set inidvidual properties. Updated
the docs also, should be out in some hour.
>
> 2. Update properties: I have tried as 16.5.2 instructs and the result are:
> a. If I PUT a JSON object that has all existing properties with new values 
> then all properties of the node are updated with new values.
> b. If I PUT a JSON object that has only one property with a new value then 
> all properties of the node are gone except the property in the PUT with the 
> new value.
>
Yes, this is intended, have added a remark to the docs, see
http://docs.neo4j.org/chunked/snapshot/rest-api-node-properties.html#rest-api-update-node-properties
and the new wording at
https://github.com/neo4j/community/blob/master/server/src/functionaltest/java/org/neo4j/server/rest/SetNodePropertiesFunctionalTest.java#L42



Does that help? What documenation URI have you been looking at (what
Neo4j version are you using)?

/peter

> Would you please explain how I can update a property and how I add new 
> properties to a node but existing properties are still intact. Thank you very 
> much!
>
> Cheers,
>
>
> ________________________________
> From: Peter Neubauer <[email protected]>
> To: Neo4j user discussions <[email protected]>
> Sent: Friday, October 14, 2011 11:40 PM
> Subject: Re: [Neo4j] Set property on node in Neo4j REST server
>
> Andrew,
> You can either update just one property or set and override all of them, see
> http://docs.neo4j.org/chunked/snapshot/rest-api-node-properties.html
>
> Does that help?
>
> /peter
>
>
>
> On Friday, October 14, 2011, andrew ton <[email protected]> wrote:
>>
>>
>> Hello,
>>
>> According to the Neo4j REST API to set a property on a node I send a PUT
> request to the node's property URL e.g.
> http://localhost:7474/db/data/node/5/properties/{propertyname}.
>> This api accepts a JSON object. How do I send a json object that has
> property name and value? The sample in the document shows the body of PUT is
> just a string while the property name is in the URL.
>>
>> Is it correct that the API should be
> http://localhost:7474/db/data/node/5/properties and the body has an
> JSONObject  e.g. {"propertyName":"propertyValue"} ?
>> If so then what is the difference between setting property and updating
> property ?
>>
>> Thanks,
>> _______________________________________________
>> Neo4j mailing list
>> [email protected]
>> https://lists.neo4j.org/mailman/listinfo/user
>>
>
> --
>
> Cheers,
>
> /peter neubauer
>
> GTalk:      neubauer.peter
> Skype       peter.neubauer
> Phone       +46 704 106975
> LinkedIn   http://www.linkedin.com/in/neubauer
> Twitter      http://twitter.com/peterneubauer
>
> http://www.neo4j.org               - Your high performance graph database.
> http://startupbootcamp.org/    - Öresund - Innovation happens HERE.
> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to