I have finally got Services up and running and setup an endpoint to nodes but can't work out how to update custom fields from a POST or PUT.
Been trawling through the docs, examples, and tutorials but none seem to offer a simple explanation of the XML payload schema to update custom fields of nodes (Using REST).
Below is an example of what I'm putting into by test client (Using REST console for Chrome plugin)
URL: http://example.com/task/node/65 Encoding: application/x-www-form-urlencoded METHOD: PUT
Payload:-
<title>New Title</title>
<body>New Body Content</body>
However this doesn't update anything, I just get the following response:-
<?xml version="1.0" encoding="utf-8"?>
<result>
<nid>65</nid>
<uri>http://example.com/task/node/65</uri>
</result>
It seems to create a revision and logs the update, but no fields are updated.
Can anyone advise the schema I need to follow for the payload? Thanks for any help or pointers!
EDIT: Thanks to Clive for a key pointer: Sticking ".xml" on the end of the URL seemed to make it update the body field, and then changing the content-type header to application/xml seemed to help as well.
So the following REST client config is now working:-
URL: http://example.com/service_endpoint/node/nid.xml
REQUEST METHOD: PUT
CONTENT-TYPE: application/xml
RAW PAYLOAD:-
<?xml version="1.0" encoding="UTF-8"?>
<data>
<name>user</name>
<title>Change this owner!</title>
<body>
<und is_array="true">
<item>
<value>Another owner test</value>
</item>
</und>
</body>
</data>
Screenshot to help anyone else using the Chrome REST Console plugin:-
NOTE: I removed all security for the service and content type to make testing it easier but wouldn't recommend this on a public server!
$node->body[LANGUAGE_NONE][0]['value']
and so on) so that bit makes sense, but if you're getting a 200 response, and the node updated date is being updated, the title should be being updatedsystem.connect
to get a session token, then to the CSRF token URL to get that token? (required as of services 3.4). There's a script using json that I know definitely works with v3.5 (found here), if you're consuming the resource in PHP it might be an idea to switch to json and try the working code as a sanity check to make sure the endpoint is functioning properly