Fulcrum provides a powerful API for taking advantage of programmatic access to many of Fulcrum’s features. With the API, you can do things like create records and photos, update apps and choice lists, and delete webhooks. The RESTful API is easy to interface with, but there are a few language-specific wrappers that make things even easier.
Fulcrum Ruby
The Fulcrum Ruby Gem can be installed using RubyGems.
gem install fulcrum
Or, if you use Bundler add the following line to your Gemfile.
gem ‘fulcrum’
Then in your application instantiate a Fulcrum client object using your API key and you’re ready to make API requests.
require ‘fulcrum’
client = Fulcrum::Client.new(your_api_key)
result = client.records.all(form_id: your_form_id, page: 1, per_page: 100)
puts result.class # Fulcrum::Page
puts result.per_page # => 100
puts result.current_page # => 1
puts result.total_pages # => 2
puts result.total_count # => 137
puts result.objects.count # => 100
puts result.objects # [ … the records … ]
In the example above, the #all method returns a Fulcrum::Page object that makes iterating through multiple pages of results trivial. Check the Fulcrum Ruby documentation for more details on available endpoints and methods.
Fulcrum Python
Install Fulcrum Python with pip.
pip install fulcrum
Just like the Ruby example, instantiate a client object using your API key. The available methods are similar to those found in Ruby.
from fulcrum import Fulcrum
client = Fulcrum(key=your_api_key)
result = client.records.search(url_params={‘form_id’: your_form_id, ‘per_page’: 100, ‘page’: 1})
print(len(result[‘records’])) # 100
print(result[‘current_page’]) # 1
print(result[‘total_pages’]) # 2
print(result[‘records’][0].__class__.__name__) # dict
Fulcrum Node
While the name suggests Fulcrum Node might only work in a Node.js environment, it will work just as well in the browser. Due to the asynchronous nature of JavaScript, the code looks a bit different than Ruby or Python. You’ll be using callbacks to process API responses.
Install Fulcrum Node with NPM.
npm install fulcrum-app
As you probably guessed, you’ll instantiate a client object using your API key before making API requests.
var Fulcrum = require(‘fulcrum-app’);
var client = new Fulcrum({api_key: your_api_key});var callback = function (error, records) {
if (error) {
console.log(‘Error: ‘, error);
return;
}
console.log(response.records.length); // 100
console.log(response.current_page); // 1
console.log(response.total_pages); // 2
};
client.records.search({form_id: your_form_id}, callback);
Resources