Coder Social home page Coder Social logo

ee2-rest's People

Contributors

adam404 avatar carolinecblaker avatar komtur avatar lucidmachine avatar philsturgeon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ee2-rest's Issues

Authentication

I love this plugin. It works like a dream for facebook and instagram.
For twitter however, I need to authenticate.
Is there a way we could make this work?
And any idea for pinterest?

Error in _force_array() function

In a few of my pages, I am getting this error when I enable debug mode:

A PHP Error was encountered
Severity: Warning
Message: strtotime() expects parameter 1 to be string, array given
Filename: rest/pi.rest.php
Line Number: 351

The relevant part of the code in pi.rest.php is this:

// Format dates to unix timestamps
elseif (isset($this->EE->TMPL->date_vars[$index]) and ! is_numeric($child))
{
    $child = strtotime($child);
}

I've tried outputting the value of $child before the strtotime call, and I see:

array(1) { ["profile_name"]=> string(18) "John Doe" }

The output is the array representation of the JSON string I expect to be returned to me.

Any ideas what be causing my issues? I am using EE 2.8.1

Use view-><var> instead of <value>

The EE (2.6.1) Developer log says:

Deprecated function set_variable() called in ...
third_party/rest/mcp.rest.php on line 156.
third_party/rest/mcp.rest.php on line 112.
third_party/rest/mcp.rest.php on line 89.
Deprecated since 2.6. Use view-> = ; instead.

EE 2.6 - Fatal PHP error on Module CP Page

I just installed Rest and get this error when I visit the module’s CP page:
Fatal error: Cannot use object of type stdClass as array in /home/public_html/system/expressionengine/core/EE_Loader.php on line 53
Can anyone suggest how I might fix this?

( ! ) Fatal error: Cannot use object of type stdClass as array in \system\expressionengine\core\EE_Loader.php on line 53

Call Stack

Time Memory Function Location

1 0.0008 269960 {main}( ) ..\admin.php:0
2 0.0024 319496 require_once( '\system\codeigniter\system\core\CodeIgniter.php' ) ..\admin.php:188
3 2.0552 9919976 call_user_func_array ( ) ..\CodeIgniter.php:319
4 2.0552 9920056 Addons_modules->show_module_cp( ) ..\CodeIgniter.php:319
5 2.0637 10423728 Rest_mcp->index( ) ..\addons_modules.php:357
6 2.0690 10454616 EE_Loader->view( ) ..\mcp.rest.php:98

Creating default object from empty value

I got problem when I started to upgrade my php version to 5.3.2 up but when I using 5.3.1 it works fine!

A PHP Error was encountered
Severity: Warning
Message: Creating default object from empty value
Filename: controllers/crew_controller.php
Line Number: ABC

Here is my API

 class Crew_controller extends MY_rest_controller
 {
  /**
  * Returns a single Crew.
  * 
  * @return xml
  */
 function crew_get()
 {
      $load = 'crew_id';
      if ($this->get('id') != '') {
         $id   = $this->get('id');     
      elseif ($this->get('hash') != '') {
        $id   = $this->get('hash');
        $load = 'hash';
     } 

    $cache = Cache::get_instance();
    $crew = $cache::get('crew' . $id);

    if (!$crew) {            
        $crew = new Crew($id);   
        $crew->load($id, $load);  
        $cache::save('crew' . $crew->crew_id, $crew, 1800);
    }

    $response = $crew->getData();   

    $this->response($response);
   }
}

And here is my FRONT Controller

    class Crew_controller extends Front_Controller
    {
      public function crew_registration($crew = null)
  {
       $personal = $this->rest->get('crew', array('hash' => $crew), 'json');    
       $personal->first_name            = $profile->first_name;   ->>>>> LINE ABC
       $personal->last_name             = $profile->last_name;
       $personal->thumbnail_url         = $profile->thumbnail_url;
      }
    }

Handle an different node?

I have a API response (not controlled by me) as follows:

<ArrayOfXmlNode xmlns:xsd="http://www.w3.org/2001/XMLSchema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance xmlns="http://www.petango.com/>
    <XmlNode>
        <adoptableSearch xmlns=">
            <ID>11422849</ID>
            <Name>Perry</Name>
        </adoptableSearch>
    </XmlNode>
    <XmlNode>
        <adoptableSearch xmlns=">
            <ID>11422850</ID>
            <Name>John</Name>
        </adoptableSearch>
    </XmlNode>
    <XmlNode xsi:nil="true"/>
</ArrayOfXmlNode>
{exp:rest name="api_url" base="XmlNode"}
    {adoptableSearch}
        <div class="person">{ID} {Name}</div>
    {/adoptableSearch}
{/exp:rest}

My problem is that the last node in my API response doesn't get handled properly and I end up getting this output in my HTML file:

<div class="person">11422850 John</div>
{adoptableSearch}
    <div class="person"> </div>
{/adoptableSearch}

Flickr API

I am unable to get any results from the Flickr API. A response is returned, but rest will not loop through any of the results. In particular I am trying to get a list of collections for a specific user. The response is prefixed by jsonFlickrApi. I have tried setting this as my base, but it has no effect. I cannot figure out why neither XML nor JSON responses will work. Any ideas?

My request:
http://api.flickr.com/services/rest/?api_key=***&method=flickr.collections.getTree&user_id=98072959@N05&format=json

Fixed a bug

Hi Phil,

Line 191 was causing errors for me in EE 2.9.2. I changed the line to : $params=$params.'&'.str_replace('param:', '', $key). '='. $this->EE->TMPL->parse_globals($var);

and it worked.

I forked/published this too but thought I'd tell you in case that wasn't the kosher thing to do. I don't really know what is. Cheers!

Given example "twitter_timeline" is depricated

The included first entry of the REST Twitter-API is old now:

{"errors": [{"message": "The Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.", "code": 68}]}

Pagination issue

Pagination doesn't seem to be working. My example is below, but all I get is the following:
https://www.dropbox.com/s/6houm87zu6eooux/Screenshot%202014-02-26%2017.03.11.png

Any idea what I might be doing wrong or if this is a possible bug?

{exp:rest url="http://brandnewbox.co.uk/v8/rss" format="xml" base="channel,item" limit="5" paginate="bottom" debug="no"}
  <p>{title}</p>

  {paginate}
   <ul class="pagination margin_bottom_04">
    {previous_page}
        <li><a href="{pagination_url}" title="Previous" class="arrow-prev pager-element">Previous</a></li>
    {/previous_page}

    {page}
        <li><a href="{pagination_url}"class="current">{pagination_page_number}</a></li>
    {/page}

    {next_page}
        <li><a href="{pagination_url}" title="Next" class="arrow-next pager-element">Next</a></li>
    {/next_page}
  </ul>
  {/paginate}
{/exp:rest}

Strip backslashes?

Is there a function to strip backslashes from results? The json query I'm using returns all apostrophes and special characters with a backslash in front of them like this: "Joe's" and, of course, I'd like those stripped out.

I'm using Low's Replace as a workaround - wrap the entire exp:rest block with this:

{exp:low_replace find="\\" regex="yes"}

But, obviously, I'd prefer that Rest do it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.