I am a beginner, trying to code to submit a vote to the Drupal7 ratings field of a node with movie content. Just as the node has a parameter for 'title', there is a parameter for 'rating-percent' which formats = "75%". A GET request of json output from a view of nodes fetches the rating percent like this (together with many other fields).
{
node = {
Body = "synopsis here";
"rating-percent" = "75%";
Nid = 16620;
What do I add to this code to post the data value (eg 75%) to the 'rating-percent' parameter? Here is my attempt at the POST:
// Send HTTP PUT Request
let Nid = "1"
// Define server side script URL
let ratingscriptUrl = "https://example.com/node/"
// Add one parameter
let urlWithParams = ratingscriptUrl + Nid
// Create NSURL Ibject
let myUrl = NSURL(string: urlWithParams);
// Create URL Request
let request = NSMutableURLRequest(URL:myUrl!);
// Set POST request
request1.HTTPMethod = "POST"
// Add parameters for 'ratings' field of node
// Execute HTTP Request
let task = NSURLSession.sharedSession().dataTaskWithRequest(request) {
data, response, error in
// Check for error
if error != nil
{
print("error=\(error)")
return
}
Thank you so much for any help you can kindly give.