Skip to main content
edited tags
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284
Source Link
droopie
  • 105
  • 1
  • 9

How to configure REST server to create new node from URL parameters?

Drupal 7.23 Services 7.x-3.5

I've followed the instructions for setting up Services module, including https://drupal.org/node/1699354. I got the endpoint setup successfully. I am able to retrieve index of nodes using ...endpoint/node and specific nodes using .../endpoint/node/#.

Now how can I create new nodes via Service through an URL? The Services manual gets really confusing at this point, is outdated and full of errors. The sample code they provide here https://drupal.org/node/1334758 ... am i supposed to put this in a custom module in order to be able to POST? If so, it turns my whole site blank right after adding this line:

// cURL 
$curl = curl_init($request_url);

Also, there's an issue with CSRF validation, as showing in the Firefox Poster tool. The Services forum is a madhouse so I come here in hopes that someone can guide me in the right direction. What other modules do I need to get this to work? Why does my site go blank after adding the code above?

A simple solution would be the following:

domain/endpoint?title=test&url=http%253A%252F%252Fwww.example.com

and produce a new node of nodetype with a title and URL.