Skip to content

Instantly share code, notes, and snippets.

@lucascaton
Last active Aug 29, 2015
Embed
What would you like to do?
Vision6 (http://vision6.com.au/) API integration (Ruby)
# Docs: http://developers.vision6.com.au/
require 'httparty'
url = 'http://www.vision6.com.au/api/jsonrpcserver.php?version=3.0'
api_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
JSON.parse(HTTParty.post(url, headers: { 'Content-Type' => 'application/json' }, body: JSON.dump({
'method' => 'getSessionInfo', 'params' => [api_key]
})))
JSON.parse(HTTParty.post(url, headers: { 'Content-Type' => 'application/json' }, body: JSON.dump({
'method' => 'searchLists', 'params' => [api_key]
})))
list_id = 123456
JSON.parse(HTTParty.post(url, headers: { 'Content-Type' => 'application/json' }, body: JSON.dump({
'method' => 'addContacts', 'params' => [api_key, list_id, [{ 'First Name' => 'Foo', 'Last Name' => 'Bar', 'Email' => 'foo@bar.com' }]]
})))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment