This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

qspec
qspec

I'm trying to write an API so someone independent of me could write software for use with my site (created of course with October). The idea being that they would create a game that would take points from a user and spit out funny money (like a slot machine). Only the software will be hosted elsewhere (and called in via iframe), and so it won't fall under the October umbrella. The issue is, how do I take points and give the reward to the right user?

Right now I have two API URI. One gets the user's data (name, point balance, etc.), the other posts the amount points played and money won. The GET API works fine. I'm unsure of the POST API since I don't know how to test it due to this authentication issue.

Bonus Question: To retrieve data sent via a POST request, do I set it up something like $points = Request::get('points') ?

Mohsin
Mohsin

Make a plugin called API or whatever for your web app and check out the code from here. It was written long back and I didn’t follow best practices but it gives you a proper idea on how you can write an API.

prakash.j40403
prakash.j40403

qspec said:

I'm trying to write an API so someone independent of me could write software for use with my site (created of course with October). The idea being that they would create a game that would take points from a user and spit out funny money (like a slot machine). Only the software will be hosted elsewhere (and called in via iframe), and so it won't fall under the October umbrella. The issue is, how do I take points and give the reward to the right user?

Right now I have two API URI. One gets the user's data (name, point balance, etc.), the other posts the amount points played and money won. The GET API works fine. I'm unsure of the POST API since I don't know how to test it due to this authentication issue.

Bonus Question: To retrieve data sent via a POST request, do I set it up something like $points = Request::get('points') ?

Mohsin
Mohsin

You can use my RESTful plugin to do this.

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.