Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ServicesException: Missing entity ID for vote tag in services_error() (line 366 of /home/example/public_html/example.com/sites/all/modules/services/includes/services.runtime.inc)
- // submit vote
- let voteEndpoint: String = "https://www.example.com/node/7291/ios1/votingapi/set_votes"
- 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"]]
- Alamofire.request(.POST, voteEndpoint, parameters: newVote, encoding: .JSON)
- .response { request, response, data, error in
- print(request)
- print (response)
- print (error)
- }
- { status code: 200, headers {
- "Cache-Control" = "no-cache, must-revalidate";
- Connection = "Keep-Alive";
- "Content-Language" = en;
- "Content-Type" = "text/html; charset=utf-8";
- Date = "Tue, 19 Jul 2016 00:09:53 GMT";
- Expires = "Sun, 19 Nov 1978 05:00:00 GMT";
- "Keep-Alive" = "timeout=10, max=200";
- Link = "</node/7291>; rel="shortlink",</Never-Return-to-Venice-chapter5>; rel="canonical"";
- Server = Apache;
- "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";
- "Transfer-Encoding" = Identity;
- "X-Content-Type-Options" = nosniff;
- "X-Frame-Options" = SAMEORIGIN;
- "X-Generator" = "Drupal 7 (http://drupal.org)";
- "X-Powered-By" = "PHP/5.6.9"; } }) nil
- // API request
- let user = "username"
- let password = "pass"
- let credentialData = "(user):(password)".dataUsingEncoding(NSUTF8StringEncoding)!
- let base64Credentials = credentialData.base64EncodedStringWithOptions([])
- let headers = ["Content-Type : application/json"]
- let voteEndpoint: String = "https://example.site/ios1/votingapi/set_votes.json"
- let newVote = ["votes":[["value":100,"uid":32,"entity_id":1,"entity_type":"node","tag":"vote","value_type":"percent"]]]
- Alamofire.request(.POST, voteEndpoint, parameters: newVote, encoding: .JSON)
- .response { request, response, data, error in
- debugPrint(response)
- print(request)
- print (response)
- print (error)
- }
- }
Add Comment
Please, Sign In to add comment