Project

General

Profile

REST API with ActiveResource PHP

Added by Dawid Gaweł about 12 years ago

Hi!

I'm trying to get some issues/projects with PHP ActiveResource and REST API. How to provide extra params, but not in class definition, but with get method?

I know there is custom method get:

class Project extends ActiveResource {
    var $site = 'xxx';
    var $request_format = 'xml'; // REQUIRED!
  }

$project = new Project();
$projects = $project->get(array('idsadsad' => '321'));

but it produces:
/projects/.xml?idsadsad=321

I have to give first param before giving array. 'all' produces:
/projects/all.xml?idsadsad=321

and '' produces:
/projects/.xml?idsadsad=321

Do you have any ideas?


Replies (1)

RE: REST API with ActiveResource PHP - Added by Anthony Potamitis almost 10 years ago

how are you authenticating?

class Issue extends ActiveResource {
var $site = 'http://yoursite.com/';
var $request_format = 'xml'; // REQUIRED!
var $element_name = 'projects';
var $extra_params = '?key=putyourkeyinhere';
}

    (1-1/1)