Skip to content
On this page

GetEquipmentPlantCodes


typescript
async function GetEquipmentPlantCodes(
  params: GetEquipmentPlantCodesParams,
  doFetch?: boolean
): Promise<NhtsaResponse<GetEquipmentPlantCodesResults> | string>

Shown with expanded params types:

typescript
async function GetEquipmentPlantCodes(
  params: {
    equipmentType: '1' | '3' | '13' | '16' | 1 | 3 | 13 | 16
    reportType:
      | 'New'
      | 'Updated'
      | 'Closed'
      | 'All'
      | 'new'
      | 'updated'
      | 'closed'
      | 'all'
    year: string | number
  },
  doFetch = true
): Promise<NhtsaResponse<GetEquipmentPlantCodesResults> | string>

💡 More In Depth

See: Package Reference

Description

GetEquipmentPlantCodes returns assigned Equipment Plant Codes. Can be filtered by Year, Equipment Type and Report Type.

ALL parameters are required and endpoint will return 404 if there are any undefined keys and/or values in the query string.

params.equipmentType:

  • 1 (Tires)
  • 3 (Brake Hoses)
  • 13 (Glazing)
  • 16 (Retread)

params.reportType:

  • 'New' (The Equipment Plant Code was assigned during the selected year)
  • 'Updated' (The Equipment Plant data was modified during the selected year)
  • 'Closed' (The Equipment Plant is no longer Active)
  • 'All' (All Equipment Plant Codes regardless of year, including their status (active or closed))

params.year:

  • year >= 2016
  • NOTE: It seems API will still respond with years < 2016 but api docs state only years >= 2016 are supported

Parameters

NameTypeDefault valueDescription
paramsObjectundefinedObject of Query Search names and values to append to the URL as a query string
params.equipmentType"1" | "3" | "13" | "16" | 1 | 3 | 13 | 16undefinedNumber equal to 1, 3, 13, or 16
params.reportType"New" | "Updated" | "Closed" | "All" | "new" | "updated" | "closed" | "all"undefined'New', 'Updated', 'Closed', or 'All'
params.yearstring | numberundefinedYear >= 2016
doFetch?booleantrueWhether to fetch the data or just return the URL (default: true)

📝 NOTE

Any params that are not listed in the table above will be ignored.

Set doFetch to false if you want to fetch the data yourself.

Returns

Returns a Promise that resolves to a NhtsaResponse object containing an array of GetEquipmentPlantCodesResults objects in the Results key.

typescript
=> Promise<NhtsaResponse<GetEquipmentPlantCodesResults>>
typescript
type NhtsaResponse<GetEquipmentPlantCodesResults> = {
  Count: number
  Message: string
  Results: Array<GetEquipmentPlantCodesResults>
  SearchCriteria: string
}
🔍 Click to Show Full Example Response
ts
// Using GetEquipmentPlantCodes({ equipmentType: 1, reportType: new, year: 2015})
// Truncated response with 943 results
const exampleResponse = {
  Count: 943,
  Message: 'Results returned successfully',
  Results: [
    {
      Address: '2950 International Blvd.',
      City: 'Clarksville',
      Country: 'UNITED STATES (USA)',
      DOTCode: '00T',
      Name: 'Hankook Tire Manufacturing Tennessee, LP',
      OldDotCode: '',
      PostalCode: '37040',
      StateProvince: 'TN',
      Status: '',
    },
    {
      Address:
        'No. 52 Street 536, Bau Tran Hamlet, Nhuan Duc Commune, Cu Chi District ',
      City: 'Ho Chi Minh',
      Country: 'Vietnam',
      DOTCode: '030',
      Name: 'SHIH FA RUBBER INDUSTRIES (VN) CO., LTD.',
      OldDotCode: '',
      PostalCode: null,
      StateProvince: null,
      Status: '',
    },
    {
      Address: 'NO. 23, HAILAR EAST ROAD',
      City: 'HUHHOT',
      Country: 'CHINA',
      DOTCode: '18V',
      Name: 'CHINA HUHHOT RUBBER PLANT',
      OldDotCode: '8V',
      PostalCode: null,
      StateProvince: 'INNER MONGOLIA',
      Status: '',
    },
    {
      Address: 'NO. 9 EAST BEISAN ROAD',
      City: 'SHENYANG',
      Country: 'CHINA',
      DOTCode: '17H',
      Name: 'SHENYANG SUNSHINE TYRE CO., LTD.',
      OldDotCode: '7H',
      PostalCode: '110025',
      StateProvince: 'LIAONING PROVINCE',
      Status: '',
    },
    {
      Address: 'HONGSHANZUI ECONOMIC DEV. ZONE',
      City: 'PINGQUAN',
      Country: 'CHINA',
      DOTCode: '181',
      Name: 'CHENGDE XIANGYAN TYRE CORP. LTD.',
      OldDotCode: '81',
      PostalCode: '067500',
      StateProvince: 'HEBEI',
      Status: '',
    },
    {
      Address: 'QIANLIU VILLAGE XIADIAN TOWN',
      City: 'CHANGYI CITY',
      Country: 'CHINA',
      DOTCode: '1TN',
      Name: 'WEIFANG LUYI RUBBER PRODUCTS CO., LTD.',
      OldDotCode: 'TN',
      PostalCode: '261311',
      StateProvince: 'SHANDONG',
      Status: '',
    },
    {
      Address: 'DOWANG TOWN',
      City: 'GUANGRAO COUNTY',
      Country: 'CHINA',
      DOTCode: '183',
      Name: 'SHANDONG HENGFENG RUBBER & PLASTIC CO., LTD.',
      OldDotCode: '83',
      PostalCode: '257335',
      StateProvince: 'SHANDONG',
      Status: '',
    },
    {
      Address: 'NO.1 HUIXIN ROAD',
      City: 'GAOTANG',
      Country: 'CHINA',
      DOTCode: '184',
      Name: 'SHIFENG JUXING TIRE CO., LTD.',
      OldDotCode: '84',
      PostalCode: '252800',
      StateProvince: 'SHANDONG PROVINCE',
      Status: '',
    },
    {
      Address: 'NO.668 LAMEI ROAD,JIESHI TOWN,BANAN DISTRICT',
      City: 'CHONGQING',
      Country: 'CHINA',
      DOTCode: '185',
      Name: 'CHONGQING WEIXING RUBBER INDUSTRY CO., LTD.',
      OldDotCode: '85',
      PostalCode: '401346',
      StateProvince: 'CHONGQING',
      Status: '',
    },
    {
      Address: 'DAWANG',
      City: 'GUANGRAO',
      Country: 'CHINA',
      DOTCode: '187',
      Name: 'SHANDONG HONGSHENG RUBBER CO., LTD.',
      OldDotCode: '87',
      PostalCode: '257335',
      StateProvince: 'SHANDONG',
      Status: '',
    },
    {
      Address: 'BARRIO URB(BIBAO SAN SEBASTIA), S/N.C.P.',
      City: 'BILBAO',
      Country: 'SPAIN',
      DOTCode: '15C',
      Name: 'BRIDGESTONE HISPANIA S.A./BILBAO',
      OldDotCode: '5C',
      PostalCode: '48970',
      StateProvince: 'BASAURI/VIZCAYA',
      Status: '',
    },
    {
      Address: 'BARRIO URB(BIBAO SAN SEBASTIA), S/N.C.P.',
      City: 'BILBAO',
      Country: 'SPAIN',
      DOTCode: '1VT',
      Name: 'BRIDGESTONE HISPANIA S.A./BILBAO',
      OldDotCode: 'VT',
      PostalCode: '48970',
      StateProvince: 'BASAURI/VIZCAYA',
      Status: '',
    },
    // ... truncated for brevity
  ],
  SearchCriteria: 'Year:2015 | Equipment Type:1 | Report Type: new',
}

If doFetch is set to false

Returns a URL string that can be used to fetch the data, does not fetch the data internally.

typescript
=> Promise<string>

// ex: => 'https://vpic.nhtsa.dot.gov/api/vehicles/GetEquipmentPlantCodes?year=2015&equipmentType=1&reportType=new&format=json'

Type - GetEquipmentPlantCodesParams

ts
type GetEquipmentPlantCodesParams = {
  year: string | number
  equipmentType: '1' | '3' | '13' | '16' | 1 | 3 | 13 | 16
  reportType:
    | 'New'
    | 'Updated'
    | 'Closed'
    | 'All'
    | 'new'
    | 'updated'
    | 'closed'
    | 'all'
}

Ƭ GetEquipmentPlantCodesParams: Object

Query String Parameters for this endpoint

Type - GetEquipmentPlantCodesResults

ts
type GetEquipmentPlantCodesResults = {
  Address: string | null
  City: string | null
  Country: string
  DOTCode: string
  Name: string
  OldDotCode: string
  PostalCode: string | null
  StateProvince: string | null
  Status: string | null
}

Ƭ GetEquipmentPlantCodesResults: Object

Objects returned in the Results array of GetEquipmentPlantCodes endpoint response.

Examples

Example 1:

  • Fetches data from VPIC API

  • Returns:

typescript
=> Promise<NhtsaResponse<GetEquipmentPlantCodesResults>>

Example 1: Get Equipment Plant Codes

ts
import { GetEquipmentPlantCodes } from '@shaggytools/nhtsa-api-wrapper'

const response = await GetEquipmentPlantCodes({
  year: 2015,
  equipmentType: 1,
  reportType: 'New',
})

Example 2:

typescript
=> Promise<string>

Example 2: Get Equipment Plant Codes and doFetch = false

ts
import { GetEquipmentPlantCodes } from '@shaggytools/nhtsa-api-wrapper'

const url = await GetEquipmentPlantCodes(
  {
    year: 2015,
    equipmentType: 1,
    reportType: 'New',
  },
  false
)

// url = 'https://vpic.nhtsa.dot.gov/api/vehicles/GetEquipmentPlantCodes?year=2015&equipmentType=1&reportType=New&format=json'

Released under the MIT License.