API Documentation

Generating API Keys

Expose each Phiona dataset as it's own data store via REST API endpoint. Includes ability to view schema, activity log, sample data, and full paginated data for each dataset

  • Ensure "x-phiona-api-key" is present in header

  • Create custom key in Phiona and add to header

  • Reach out to support@phiona.com for any questions

To expose the dataset as an API endpoint, click on the "Create API" link within the dataset tile. This will provide an API link, along with the different actions available. You will need a secret key to access the link. Click on the person icon on the bottom left to create a secret key.

A window will pop up that shows you all of the existing API keys for the Phiona datasets, as well as details about when the API key was created, last used, the number of requests through the API, and whether the API is active or not. You can also revoke the API key as well if you need to remove authorization from an application to access the data.

If you're creating a new key, click on the link highlighted below.

You can create multiple secret keys for different users for audit purposes. Copy your generated secret key to a safe place.

Once your desired API keys and endpoints have been generated, you can access your dataset from an external source.

Creating API Endpoints

Once you've created your API access key, you can then create a dataset endpoint to access. Click on the Create REST API link on the dataset you would like to enable access to.

A window will pop up allowing you to enable the API to be used.

Enable the API to see the details. You will see the API endpoint link, along with the operations that the Phiona API supports. If at any time you want to disable the link to the dataset endpoint, click on the Enabled slider to disable access.

GET Sample Data Records

curl --location --request GET 'https://app.phiona.com/api/v1/<user_id>/<dataset_key>/sample' \
--header 'x-phiona-api-key: {secretkey}'

Retrieve sample data rows for a given dataset.

GET Dataset Schema

curl --location --request GET 'https://app.phiona.com/api/v1/<user_id>/<dataset_key>/schema' \
--header 'x-phiona-api-key: {secretkey}'

Retrieve schema (field_id, column name, column type, column metrics) for given dataset.

Schema Type

Example

field_id

5e826246cd3107ecc6960153

name

first_name

type

text

percent_valid

96.8

percent_null

3.2

unique

854

GET Dataset Activity Log

curl --location --request GET 'https://app.phiona.com/api/v1/<user_id>/<dataset_key>/log' \
--header 'x-phiona-api-key: {secretkey}'

Retrieve changes made to dataset.

GET Dataset Data

curl --location --request GET 'https://app.phiona.com/api/v1/<user_id>/<dataset_key>/rows/1' \
--header 'x-phiona-api-key: {secretkey}'

Retrieve sample data rows for a given dataset.

Default page number is "1", and 500 results are served at a time to improve performance.

POST Data Query

curl --location --request GET 'https://app.phiona.com/api/v1/<user_id>/<dataset_key>/search' \
--header 'x-phiona-api-key: {secretkey}'

Insert JSON query for field to search, value to search, and whether you'd like an exact or contains match.

{
	"query": [
		{
			"field": "<field_name>",
			"value": "<value>",
			"operation": "exact"
		},
		{"field": "<field_name>",
			"value": "<value>",
			"operation": "contains"}
	]
}

All of the corresponding data values will be returned in JSON form.

POST Data Transform

curl --location --request GET 'https://app.phiona.com/api/v1/<user_id>/<dataset_key>/transform' \
--header 'x-phiona-api-key: {secretkey}'

Insert JSON query to create data transformations based on the fields within the dataset. The Data Transform query supports unique count (both text and number fields) as count, sum, min, max, mean and median.

{
	"field": "<field_name>",
			"operation": "count"
}

Last updated