Created
September 13, 2021 09:14
-
-
Save sielay/c55ba22428b5b4c719c30065a9a2eb37 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const https = require('https'); | |
const API_KEY = 'KEY HERE'; | |
const data = JSON.stringify({ | |
registrationNumber: 'REGNUMBER' | |
}) | |
const options = { | |
hostname: 'driver-vehicle-licensing.api.gov.uk', | |
port: 443, | |
path: '/vehicle-enquiry/v1/vehicles', | |
method: 'POST', | |
headers: { | |
'x-api-key': API_KEY, | |
'Content-Type': 'application/json' | |
} | |
} | |
const req = https.request(options, res => { | |
console.log(`statusCode: ${res.statusCode}`) | |
res.on('data', d => { | |
process.stdout.write(d) | |
}) | |
}) | |
req.on('error', error => { | |
console.error(error) | |
}) | |
req.write(data) | |
req.end() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment