Skip to content

Instantly share code, notes, and snippets.

@sielay
Created September 13, 2021 09:14
Show Gist options
  • Save sielay/c55ba22428b5b4c719c30065a9a2eb37 to your computer and use it in GitHub Desktop.
Save sielay/c55ba22428b5b4c719c30065a9a2eb37 to your computer and use it in GitHub Desktop.
'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