Accessing the API Using HTTP Requests

Requesting Dataset Metadata

Authentication

This method does not require authentication. An API key is not required.

Arguments

$metadata (required)

Example URL

Read the metadata for the FORMS dataset

http://api.dol.gov/V1/FORMS/$metadata

HTTP Error Codes

Error Code Error Text Comments
404 Resource not found The dataset name or table name is invalid

Comments

None

Reading a table

Authentication

This method does not require authentication.

Arguments

None

Example URL

Read Agencies table from the FORMS dataset

http://api.dol.gov/V1/FORMS/Agencies

HTTP Error Codes

Error Code Error Text Comments
404 Resource not found The dataset name or table name is invalid

Comments

A maximum of 100 records will be returned

Limit the number of results returned

Authentication

This method does not require authentication.

Arguments

$top (required)

Example URL

Read the first 10 records of the Agencies table from the FORMS dataset

http://api.dol.gov/V1/FORMS/Agencies?$top=10

HTTP Error Codes

Error Code Error Text Comments
400 Bad Request The query contains an error. Read returned value for specific error.
404 Resource not found The dataset name or table name is invalid

Comments

A maximum of 100 records will be returned

Skip a Number of Results

Authentication

This method does not require authentication

Arguments

$skip (required)

Example URL

Read the Agencies table from the FORMS dataset, skipping the first 5 results

http://api.dol.gov/V1/FORMS/Agencies?$skip=5

HTTP Error Codes

Error Code Error Text Comments
400 Bad Request The query contains an error. Read returned value for specific error.
404 Resource not found The dataset name or table name is invalid

Comments

A maximum of 100 records will be returned

Data Pagination by Combining Top and Skip

Authentication

This method does not require authentication

Arguments

$top (required)
$skip (required)

Example URL

Read records 21-30 from the Agencies table in FORMS dataset

http://api.dol.gov/V1/FORMS/Agencies?$skip=20&$top=10

HTTP Error Codes

Error Code Error Text Comments
400 Bad Request The query contains an error. Read returned value for specific error.
404 Resource not found The dataset name or table name is invalid

Comments

A maximum of 100 records will be returned

Selecting Specific Columns

Authentication

This method does not require authentication

Arguments

$select

Example URL

Read records from the AgencyForms table in FORMS dataset, returning only the FormNumber and Title columns.

http://api.dol.gov/V1/FORMS/AgencyForms?$select=FormNumber,Title

HTTP Error Codes

Error Code Error Text Comments
400 Bad Request The query contains an error. Read returned value for specific error.
404 Resource not found The dataset name or table name is invalid

Comments

A maximum of 100 records will be returned

Sorting Data

Authentication

This method does not require authentication

Arguments

$orderby

Example URLs

Read records from the AgencyForms table in FORMS dataset, sorting by the FormNumber column.

http://api.dol.gov/V1/FORMS/AgencyForms?$orderby=FormNumber

To sort the column by desc order, add desc after the column name

http://api.dol.gov/V1/FORMS/AgencyForms?$orderby=FormNumber desc

HTTP Error Codes

Error Code Error Text Comments
400 Bad Request The query contains an error. Read returned value for specific error.
404 Resource not found The dataset name or table name is invalid

Comments

  • Ascending is the default order.
  • A maximum of 100 records will be returned
  • More than one column can be specified. Separate column names with commas.

Filtering Data - Single Filter

Authentication

This method does not require authentication

Arguments

$filter

Comparison Keywords

eq – Equal to
ne – Not Equal to
gt – Greater than
lt – Less than
ge – Greater than or equal to
le – Less than or equal to

Example URL

Read records from the AgencyForms table in FORMS dataset, returning only the records where the AgencyId is equal to 'MSHA'.

http://api.dol.gov/V1/FORMS/AgencyForms?$filter=AgencyId eq 'MSHA'

Example Response

[response]

HTTP Error Codes

Error Code Error Text Comments
400 Bad Request The query contains an error. Read returned value for specific error.
404 Resource not found The dataset name or table name is invalid

Comments

A maximum of 100 records will be returned

Filtering Data - Multiple Filters

Authentication

This method does not require authentication

Arguments

$filter (required)
and
or

Comparison Keywords

eq – Equal to
ne – Not Equal to
gt – Greater than
lt – Less than
ge – Greater than or equal to
le – Less than or equal to

Example URL

Read records from the AgencyForms table in FORMS dataset where the AgencyId is equal to MSHA and the Title is equal to 'Legal Identity Report'.

http://api.dol.gov/V1/FORMS/AgencyForms?$filter=(AgencyId eq 'MSHA') and (Title eq 'Legal Identity Report')

HTTP Error Codes

Error Code Error Text Comments
400 Bad Request The query contains an error. Read returned value for specific error.
404 Resource not found The dataset name or table name is invalid

Comments

A maximum of 100 records will be returned