Last active
September 15, 2022 00:52
-
-
Save philfreo/9359930 to your computer and use it in GitHub Desktop.
Close API Ruby RestClient Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
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
This uses https://github.com/rest-client/rest-client for simple REST calls