The Department of Labor Developer Community

Accessing the APIs Using HTTP Requests

Table of contents

    Requesting Dataset Metadata

    Authentication

    This method does not require authentication

    Arguments

    $metadata (required)

    Example URL

    http://api.dol.gov/V1/FORMS/$metadata
    Read the metadata for the FORMS dataset

    HTTP Error Codes

    404: Resource not found
    The dataset name is invalid.

    Comments

    None

    Reading a table

    Authentication

    This method does not require authentication

    Arguments

    None

    Example URL

    http://api.dol.gov/V1/FORMS/Agencies
    Read Agencies table from the FORMS dataset

    HTTP Error Codes

    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

    http://api.dol.gov/V1/FORMS/Agencies?$top=10
    Read the first 10 records of the Agencies table from the FORMS dataset

    HTTP Error Codes

    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

    http://api.dol.gov/V1/FORMS/Agencies?$skip=5
    Read the Agencies table from the FORMS dataset, skipping the first 5 results

    HTTP Error Codes

    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

    http://api.dol.gov/V1/FORMS/Agencies?$skip=20&$top=10
    Read records 21-30 from the Agencies table in FORMS dataset

    HTTP Error Codes

    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

    http://api.dol.gov/V1/FORMS/AgencyForms?$select=FormNumber,Title
    Read records from the AgencyForms table in FORMS dataset, returning only the FormNumber and Title columns.

    HTTP Error Codes

    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 URL

    http://api.dol.gov/V1/FORMS/AgencyForms?$orderby=FormNumber
    Read records from the AgencyForms table in FORMS dataset, sorting by the FormNumber column.

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

    Example URL

    http://api.dol.gov/V1/FORMS/AgencyForms?$orderby=FormNumber desc
    Ascending is the default order.

    HTTP Error Codes

    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
    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

    http://api.dol.gov/V1/FORMS/AgencyForms?$filter=AgencyId eq 'MSHA'
    Read records from the AgencyForms table in FORMS dataset, returning only the records where the AgencyId is equal to 'MSHA'.

    Example Response

    [response]

    HTTP Error Codes

    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
    More than one filter can be specified. See [link] article for details.

    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

    http://api.dol.gov/V1/FORMS/AgencyForms?$filter=(AgencyId eq 'MSHA') and (Title eq 'Legal Identity Report')
    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 Error Codes

    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

    Tags: 

    Back to Top