๐ BIG NEWS ๐ โฆ Avo 4 has officially SHIPPED โฆ ๐ the beta is over, 4.0 is here โฆ ๐ ๏ธ build admin panels, dashboards & internal tools at light speed โฆ โญ you are visitor #1,136,451 โฆ ๐ tell a friend โฆ best viewed in Ruby on Rails โฆ ๐ click here to see what’s new โฆ
HTTP Resource
Turn any external HTTP API into a fully-featured Avo resource and manage remote data like it's local.
# $40/mo
gem "avo-http_resource"
Have any API available inside Avo in a few minutes. HTTP Resource backs an Avo resource with an external endpoint instead of Active Record, so a Stripe, GitHub, or in-house REST API shows up in your Avo app as a normal index, show, edit, and new screen, with no local table or model to set up first. You manage records that live behind an API the same way you manage your database tables.
Generate one with bin/rails generate avo:resource Author --http,
point the http_adapter hash at the endpoint, map the JSON
back to fields, and you have a working admin screen, no HTTParty client,
pagination, or CRUD plumbing to write and maintain yourself. The slow part of
putting a third-party API behind an admin is already done.
What it looks like
One http_adapter block turns a REST endpoint into a full Avo resource:
class Avo::Resources::Author < Avo::BaseResource
self.http_adapter = {
endpoint: "https://api.example.com/authors",
headers: { "Authorization" => "Bearer " + ENV["API_TOKEN"] },
parse_collection: ->(response) { response.parsed_response["data"] },
parse_record: ->(response) { response.parsed_response["author"] },
parse_count: ->(response) { response.parsed_response["meta"]["total"] }
}
def fields
field :id, as: :id
field :name, as: :text
field :email, as: :text
end
end
What you get
-
Stand up a full admin for any REST API in one command,
bin/rails generate avo:resource Name --http, with no table or model behind it -
Manage records that never touch your database: point
http_adapterat the endpoint and the upstream API behaves like a normal Avo resource -
Render messy upstream payloads cleanly by reshaping JSON to your fields with
parse_collection,parse_record, andparse_count -
Work against authenticated, paginated APIs out of the box, pass tokens through
headersand build query strings from controller params - Edit a remote record the way you edit a local one, with full create, read, update, and delete over HTTP through the built-in HTTParty client
-
Fail gracefully when the upstream API is down: raise
Avo::HttpErrorand the user sees a flash message instead of a stack trace
Why it pays off
- Go from an API endpoint to a working admin in a few minutes, instead of building a client, pagination, and CRUD plumbing over a sprint.
- Every Avo release makes it better: the HTTParty client, request timeouts, and error handling stay maintained and keep working through upgrades, without you patching them.
- Your API-backed records reuse the same Avo resource, field, and action machinery, so they look and behave like the rest of your app, not a bolted-on one-off.
# included in
# ready to ship?
You ship it this afternoon. We keep it solid for years.