Guest User

Untitled

a guest
Apr 19th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. ServicesException: Missing entity ID for vote tag in services_error() (line 366 of /home/example/public_html/example.com/sites/all/modules/services/includes/servi‌​ces.runtime.inc)
  2.  
  3. // submit vote
  4.  
  5. let voteEndpoint: String = "https://www.example.com/node/7291/ios1/votingapi/set_votes"
  6. let newVote = ["votes":["value":40, "uid":235, "vote_id":75000, "timestamp":146882901, "vote_source":"70.36.223.173", "entity_id":7291, "entity_type":"node", "tag":"vote", "value_type":"percent"]]
  7. Alamofire.request(.POST, voteEndpoint, parameters: newVote, encoding: .JSON)
  8. .response { request, response, data, error in
  9. print(request)
  10. print (response)
  11. print (error)
  12. }
  13.  
  14. { status code: 200, headers {
  15. "Cache-Control" = "no-cache, must-revalidate";
  16. Connection = "Keep-Alive";
  17. "Content-Language" = en;
  18. "Content-Type" = "text/html; charset=utf-8";
  19. Date = "Tue, 19 Jul 2016 00:09:53 GMT";
  20. Expires = "Sun, 19 Nov 1978 05:00:00 GMT";
  21. "Keep-Alive" = "timeout=10, max=200";
  22. Link = "</node/7291>; rel="shortlink",</Never-Return-to-Venice-chapter5>; rel="canonical"";
  23. Server = Apache;
  24. "Set-Cookie" = "DRUPAL_UID=0; expires=Mon, 18-Jul-2016 00:09:53 GMT; Max-Age=-86401; path=/; domain=.example.com; secure, DRUPAL_UID=-1; expires=Thu, 11-Aug-2016 03:43:13 GMT; Max-Age=1999999; path=/; domain=.example.com; secure";
  25. "Transfer-Encoding" = Identity;
  26. "X-Content-Type-Options" = nosniff;
  27. "X-Frame-Options" = SAMEORIGIN;
  28. "X-Generator" = "Drupal 7 (http://drupal.org)";
  29. "X-Powered-By" = "PHP/5.6.9"; } }) nil
  30.  
  31. // API request
  32.  
  33. let user = "username"
  34. let password = "pass"
  35. let credentialData = "(user):(password)".dataUsingEncoding(NSUTF8StringEncoding)!
  36. let base64Credentials = credentialData.base64EncodedStringWithOptions([])
  37. let headers = ["Content-Type : application/json"]
  38. let voteEndpoint: String = "https://example.site/ios1/votingapi/set_votes.json"
  39. let newVote = ["votes":[["value":100,"uid":32,"entity_id":1,"entity_type":"node","tag":"vote","value_type":"percent"]]]
  40. Alamofire.request(.POST, voteEndpoint, parameters: newVote, encoding: .JSON)
  41. .response { request, response, data, error in
  42. debugPrint(response)
  43. print(request)
  44. print (response)
  45. print (error)
  46. }
  47.  
  48.  
  49. }
Add Comment
Please, Sign In to add comment