You can do this:
Code:
Sub Test()
Dim DvlaService As Object
Dim Response As String
API_KEY = "XXX"
Set DvlaService = CreateObject("MSXML2.XMLHTTP")
With DvlaService
.Open "POST", "https://driver-vehicle-licensing.api.gov.uk/vehicle-enquiry/v1/vehicles", False
.setRequestHeader "Content-Type", "application/json"
.setRequestHeader "Accept", "application/json"
.setRequestHeader "x-api-key", API_KEY
.send "{""registrationNumber"": """ & RegistrationNumber & """}"
Response = .responseText
End With
CurrentDb.Execute "INSERT INTO RegRaw (ServerResponse) VALUES (" & Response & ");"
End Sub
I do not know where you're gonna get RegistrationNumber from. I also don't know how your table looks. I also don't know why your Response variable was an object. And I don't know at what point you're defining the API_KEY. As you can see, not much changes. But you will definitely want to parse the response into the corresponding fields. For that to be easy, use the VBA-JSON library from github, look it up. Add it to your Access file. With that you'll be able to write Response("make"), and if you had a field called make in your table, you could add it to the INSERT INTO instruction above