Using the Ruby client

    We released a Ruby gem to make it easy to programmatically read/create/edit/destroy any kind of resource a DatoCMS project might contain. Add this line to your application's Gemfile and then install the gem running bundle install within your terminal:

    gem "dato"

    The first step is to require the DatoCMS gem, and initialize the client with the read-write API token you can find under the Admin area > API tokens section:

    require "dato"
    # create a DatoCMS client
    client = Dato::Site::Client.new("YOUR_API_READWRITE_TOKEN")

    If you need to work on a sandbox environment, you can pass its name as second argument:

    client = Dato::Site::Client.new(
    "YOUR_API_READWRITE_TOKEN",
    environment: "my-sandbox"
    )

    Further documentation

    Our API reference has Ruby examples for each of the available endpoints. Here's a list of the ones you'll probably find using more often: