简体   繁体   中英

How to communicate with an API

I am developing a Wordpress plugin that needs to retrieve an Affiliate ID from an outside website - a website based upon this API .

The idea is this:

1) Refer the user to the website and have them sign up as affiliate.

2) User returns to the Wordpress CMS and enters their Affiliate ID

3) Somehow I would like to verify the correct/incorrect Affiliate ID after saving user input.

So my question is 2 parts:

a. How do I accomplish validation of a user's affiliate ID?,

b. Do I need to load the API inside of my Wordpress plugin, or do I communicate with the API through the outside server?

Regarding b):

You need to make the calls within your WordPress plugin. I got the feeling that you're missing some basics. Please have a look at this article about HTTP & REST.

Basically you only have to make a POST request and the API returns you what ever you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM