HTTP Request Enrichments
What are HTTP Request Enrichments?
HTTP Request Enrichments allow you to enrich your dataset using any HTTP service. This allows you to build enrichments using any service that Census may not natively support. Similar to AI columns and other enrichments, Census allows you to configure a HTTP request that is unique to each row in your dataset, and map the response back to a column. The enrichment is stored and materialized back in your warehouse.
Example Use Cases
HTTP Request Enrichments are currently supported for Snowflake, Redshift, BigQuery, Databricks, and Postgres.
Creating a HTTP Request Enrichment
For this example, we will use MaxMind to enrich website event data with geographic information.
Defining a HTTP Request Connection
Login to Census and select a Dataset you want to enrich on the Datasets tab
Ensure that your dataset has a Unique ID Column. You can configure this by setting the Type and Property Mappings on the Dataset
On the top right corner, navigate to Enrich & Enhance > Enrichments > HTTP Request
Create a new HTTP Request Connection, or select an existing connection that you want to use
For MaxMind, we will use their GeoLite API: https://geolite.info/geoip/v2.1/country
You will need to add an Authorization Header in the form
Bearer <API KEY>
When creating a new HTTP Request Connection, you will be asked to input the static Base URL
and any other Headers
required for your request. Note that the static Base URL
does not include the endpoint
, as this may be a dynamic value that will be configured in the next step
Example:
Say you want to query from https://geolite.info/geoip/v2.1/country/192.168.123.132
. In this case, the Base URL
is https://geolite.info/geoip/v2.1/country
and the endpoint
is 192.168.123.132
Defining the Request
Once you have your HTTP Request Connection selected, you can begin setting up your HTTP request
Name your enrichment
Choose an HTTP method, ex.
GET
Configure your endpoint. This could be a constant value, or use Liquid Templates to encode record values in your endpoint. Note that the
url_encode
Liquid Filter should be used to ensure that any special characters in your data will be parsed properly to be used in the URLIf your chosen HTTP method supports defining a request body (ex.
POST
), you can also use Liquid Templates to reference column values for each row.
The request body should be a valid JSON object.
Defining the Response
It is expected that the response from the endpoint is a JSON object.
Define each column of your enrichment by mapping the output names to keys in the returned JSON object. Each output name can be either a:
Top level key of the JSON object
A valid JSONPath pointing to a nested value in the JSON object
Final Steps
Once you are done configuring your request and response, you can go ahead and create your HTTP Column!
Behind the scenes, Census will set up a table in your warehouse to store your enriched data. Census will also create a sync configuration that runs your enrichment and writes it into the created table.
Last updated
Was this helpful?