Skip to content

Instantly share code, notes, and snippets.

@philfreo
Last active September 15, 2022 00:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save philfreo/9359930 to your computer and use it in GitHub Desktop.
Save philfreo/9359930 to your computer and use it in GitHub Desktop.
Close API Ruby RestClient Example
require 'rest_client'
require 'json'
API_KEY = 'your api key here'
api_base = 'https://' + API_KEY + ':@api.close.com/api/v1/'
# get info about yourself
RestClient.get api_base+'me/'
# post a lead
lead_data = {
'name' => 'test lead',
'contacts' => [{
name: 'my person'
}]
}
RestClient.post api_base+'lead/', JSON.generate(lead_data), :content_type => :json, :accept => :json
@philfreo
Copy link
Author

philfreo commented Mar 5, 2014

This uses https://github.com/rest-client/rest-client for simple REST calls

@philfreo
Copy link
Author

Or, if you're looking for a more complete Ruby SDK for the Close API, check out https://github.com/taylorbrooks/closeio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment