Sign up FREE & get 250 points
 More options
Points2Shop Forums » Referral Talk » Can anyone help with getting REST API working on my site?
Created: 2016-06-02 10:41:33
ttimmy2005
UK elite
Senior Poster
Total posts: 246

Bit of a technical question that I am hoping someone might be able to help me with.

I would like to display a few things on my site, but alas the "widgets" don't seem to be working anymore. It appears that I need to make use of the API section. I would like to display:

  • Shoutbox
  • Most recent offers
  • Testimonials
I have looked at the php scripts for using the REST API, and am wondering how to get them to display on my html page. If someone could run through how to get the shoutbox to display, I could then work out the rest of the things I want to display from that.

Cheers
ldpx3000
US moderator
Points2shop is my specialty
Total posts: 1117
The API is not that hard to work, I can help you with anything you might need :)

The way to get the shoutbox or any other data to display on your screen is to pull down the data, iterate over each item, draw the item to the page.


$shoutbox_array = json_decode($shoutbox);
// at this point, $shoutbox_array contains arrays consisting of shoutbox fields

for(int i = 0; i < $shoutbox_array.length(); i ++)
{
//For every shout, create a new row and add it your page display
$item = $shoutbox_array[i];
echo "..........." ;
}


Don't use the above verbatim since I haven't used PHP in a while, so its off the top of my head. But this is essentially the same thing that is done on the mobile apps, just a different language :)
'Build a better idiot proof system and the universe will build a better idiot...'
ttimmy2005
UK elite
Senior Poster
Total posts: 246
Any chance you could maybe knock up a quick script that I can just paste onto my sites page (when you get a spare 5 mins)? Also, will i need the example php script (found in the api section), with my api key inserted, placed in my home dir?

Sorry to sound so stupid, I just can't seem to get my brain to face the right way on this one.
buddhabossSTL808647
US diamond
Junior Poster
Total posts: 53
Total Earnings: $1077.77
do not give up!!!!

You are not logged in.

Chat History

will load when you scroll to the bottom