API external endpoints

By: Nick Brittan | Asked: 05/14/2024
ForumsCategory: Code HelpAPI external endpoints
Nick Brittan asked 2 weeks ago
Hi,

I am attempting (badly) to call in data from an external API that holds vehicle data. This is the DVLA API and I am specifically looking to get the responses from VES.

Here are the docs - https://developer-portal.driver-vehicle-licensing.api.gov.uk/apis/vehicle-enquiry-service/vehicle-enquiry-service-description.html#vehicle-enquiry-service-ves-api-guide

I have registered and have an Authentication Token "key"

This endpoint takes the "registrationNumber" and returns the responses.

I have contacted support but they seem reluctant to give any API assistance so that avenue is a deadend.

I have a form will fields for every available response and wish to submit the "registrationNumber" and then populate the relevant field with the relevant response data.

I am hitting a dead-end.

I have this hook in WP Code. The obvious have been double checked, e.g. form ID, etc!

add_filter( 'frm_api_form_action', 'add_custom_header_to_api_request', 10, 2 ); function add_custom_header_to_api_request( $action, $form ) {
// Check if the form is the one you want to modify
if ( $form->id === 23 ) {
// Modify the action to include the custom header
$action['headers']['x-api-key'] = 'MYSECRETKEY';
}
return $action;
}

Within my my form I have a "Send API data" action with the endpoint in the "Notification URL"
https://driver-vehicle-licensing.api.gov.uk/vehicle-enquiry/v1/vehicles

The "Basic Auth" value is blank as the authentication cannot be used here, as far as I can figure out anyway.

I realise that this is going to require some custom code, but cannot find a definitive path and direction to investigate or follow.

Any and all pointers and assistance welcome and greatly appreciated.

P.S. I am no programmer so bear with me here.

Thanks in advance.

Regards,
Nick

Attachments
Question Tags:
2 Answers
Victor Font answered 2 weeks ago
Nick, I already responded to your private emails. I'm disappointed that you posted this here when I already started working with you on this problem.
Nick Brittan replied 2 weeks ago

Apologies Victor it wasn't intended. I have just seen your reply and responding now. This post was done before checking my email.

Nick Brittan answered 2 weeks ago
I would like to give a shout-out to Formidable Support. Once again, they have assisted me in finding what I knew was evading my search. It's really quite simple to change the API headers and write the API response back to a form. This is in an early scoping stage, so it is not a final solution, but if anyone needs a starting point, I am happy to share.

-_- It turns out I am not all over the place and seem to lack focus after all.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right