0

I got a private API (Cliniko) I want for example the full list of clients to be listed where I want on a page. I know how APIs work, what I don't know is how to implement them in Wordpress.

Is there a plugin that can help me do it? Or, what's the better way to do it?

And yes I have searched google up to page 10(and clicked almost every single link) I have seen lots of guides or maybe things that can work but nothing consistent, and almost everything that could be good is at least 3 years old, that's why I'm asking here, so please don't be *****. Thank you very much for any help, that's very much appreciated.

1 Answer 1

0

You can fetch data using wp_remote_get().

//API URL
$url = 'your api url';

// API RESPONSE
$response = wp_remote_get($url, "your headers goes here / use array to set multiple headers.");

you can then access content from $response.

$response['body']; // will give you content.

wrap it with your own function name and add this code in your functions.php file. Call the function from your custom page template file.

2
  • That looks like a good idea, I'll try that as soon as I get home! Commented Apr 22, 2019 at 23:26
  • Sure, let us know if it works for you. Commented Apr 23, 2019 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.