CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • API Explorer results panel in Joomla
Pages: [1]

Author Topic: API Explorer results panel in Joomla  (Read 2604 times)

speleo

  • Ask me questions
  • ****
  • Posts: 396
  • Karma: 28
  • CiviCRM version: 4.3.1
  • CMS version: J! 2.5,9
  • MySQL version: 5.1
  • PHP version: 5.3.24
API Explorer results panel in Joomla
May 19, 2012, 06:04:45 am
On my Joomla 2.5.4 / Civi 4.1.2 site the API Explorer results panel shows the full html of page itself (with all the Joomla admin templating) and not the Ajax results as expected.

The "Ajax Query" link in the table above opens a new tab with everything displaying as expected

Any ideas?
« Last Edit: May 20, 2012, 11:56:34 am by speleo »

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: API Explorer results panel
May 19, 2012, 01:12:17 pm
Can you look in Firebug for Firefox for any JS errors?
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

speleo

  • Ask me questions
  • ****
  • Posts: 396
  • Karma: 28
  • CiviCRM version: 4.3.1
  • CMS version: J! 2.5,9
  • MySQL version: 5.1
  • PHP version: 5.3.24
Re: API Explorer results panel
May 19, 2012, 01:36:42 pm
Hi Hershel,

I'm using Chrome and IE9 and can't see any JS errors. 
That might be because I'm not entirely sure where to look but I've had a good root around and can't see any JS issues.
I'm using the standard J! admin template so nothing special going on there.   

Tried seeing if I could reproduce on the Joomla sandbox @ http://sandbox.joomla.civicrm.org/administrator/index.php  but that is broken at the moment.

speleo

  • Ask me questions
  • ****
  • Posts: 396
  • Karma: 28
  • CiviCRM version: 4.3.1
  • CMS version: J! 2.5,9
  • MySQL version: 5.1
  • PHP version: 5.3.24
Re: API Explorer results panel in Joomla
May 24, 2012, 11:44:34 pm
Getting the same issue on the Joomla sandbox

http://joomla.demo.civicrm.org/administrator/index.php?option=com_civicrm&task=civicrm/ajax/doc/api#/administrator/?option=com_civicrm&task=civicrm/ajax/rest&json=1&sequential=1&debug=1&&entity=Contact&action=get

This looks like a Joomla feature? Raise a case?

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: API Explorer results panel in Joomla
May 25, 2012, 04:03:05 am
Hi,

What is the url called by the ajax? It sounds we don't call the right one.

Do you know which one it should be? civicrm/ajax/rest is the one on drupal, but that's not the one we should use.

Sorry, can't be of much help, don't have a joomla install, would be great if you could investigate.
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

speleo

  • Ask me questions
  • ****
  • Posts: 396
  • Karma: 28
  • CiviCRM version: 4.3.1
  • CMS version: J! 2.5,9
  • MySQL version: 5.1
  • PHP version: 5.3.24
Re: API Explorer results panel in Joomla
May 25, 2012, 04:34:00 am
on the demo if I click the ajax query link it takes me here:

http://joomla.demo.civicrm.org/administrator/?option=com_civicrm&task=civicrm/ajax/rest&json=1&sequential=1&debug=1&&entity=Contact&action=get

which looks good.  Seems to me that we can get the right results but are asking for the wrong link.  What I don't know is where that request comes from. 

Can you give me a clue as to were to look for what it is trying to call?

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: API Explorer results panel in Joomla
May 25, 2012, 04:52:53 am
It's all done from templates/CRM/Core/AjaxDoc.tpl

Code: [Select]
restURL = '{crmURL p="civicrm/ajax/rest"}';

is where we initialise it.

Could you see what url is calls (eg in firebug). I don't get why I display the right ajax call but call the wrong one.

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

speleo

  • Ask me questions
  • ****
  • Posts: 396
  • Karma: 28
  • CiviCRM version: 4.3.1
  • CMS version: J! 2.5,9
  • MySQL version: 5.1
  • PHP version: 5.3.24
Re: API Explorer results panel in Joomla
May 25, 2012, 08:44:52 am
Hi Xavier,

To be honest I'm not entirely sure what I'm looking for here.  The URL seems to fine except there is an extra "amp;" in the middle.

http://joomla.demo.civicrm.org/administrator/index.php?option=com_civicrm&task=civicrm/ajax/doc/api#/administrator/?option=com_civicrm&task=civicrm/ajax/rest&json=1&sequential=1&debug=1&&entity=Contact&action=get

or look at this another way this doesn't work

(http://api_explorer_error1.jpg)

but this does

(http://api_explorer_good1.jpg)

wopuld be easier to show if we weren't linited to 64K attachments.
« Last Edit: May 25, 2012, 08:49:59 am by speleo »

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: API Explorer results panel in Joomla
May 25, 2012, 09:48:16 am
What browser are you using? That's supposed to be the same (well not exactly but both should work).

Could you paste which url works and which doesn't, not sure if the & is the correct or wrong one.
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

speleo

  • Ask me questions
  • ****
  • Posts: 396
  • Karma: 28
  • CiviCRM version: 4.3.1
  • CMS version: J! 2.5,9
  • MySQL version: 5.1
  • PHP version: 5.3.24
Re: API Explorer results panel in Joomla
May 25, 2012, 10:16:47 am
I use Chrome mostly and for some corporate stuff Internet Damager 9 (as they've coded around all it's bugs).  This is the same with both.

Do this:
  • Load http://joomla.demo.civicrm.org/administrator/index.php?option=com_civicrm&task=civicrm/ajax/doc/api#explorer
    demo / demo for authentication
  • entity=contact action=get.  This creates the following link in the box below
    /administrator/option=com_civicrm&task=civicrm/ajax/rest&json=1&sequential=1&debug=1&&entity=Contact&action=get
    and incorrectly fills the grey results panel
  • for the correct result replace com_civicrm&task with com_civicrm&task in the form url area (not the browser url).
    Then click on go and the api explorer should work correctly
« Last Edit: May 25, 2012, 10:23:28 am by speleo »

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: API Explorer results panel in Joomla
May 25, 2012, 10:57:08 am
after
restURL = '{crmURL p="civicrm/ajax/rest"}';

can you add
restURL.replace("&","&"); // J! fix CRM-xxx

and see if it does it for you?

fill an issue (and assign to me) if it does.

btw, we are trying to promote civicrm/api/explorer as  the "official" address for the api explorer, so:
http://joomla.demo.civicrm.org/administrator/index.php?option=com_civicrm&task=civicrm/api/explorer

(doesn't have any impact on the bug, just a clearer url)
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

speleo

  • Ask me questions
  • ****
  • Posts: 396
  • Karma: 28
  • CiviCRM version: 4.3.1
  • CMS version: J! 2.5,9
  • MySQL version: 5.1
  • PHP version: 5.3.24
Re: API Explorer results panel in Joomla
May 25, 2012, 11:39:13 am
sorry - no difference.  Time to think more on this...getting close I think.

speleo

  • Ask me questions
  • ****
  • Posts: 396
  • Karma: 28
  • CiviCRM version: 4.3.1
  • CMS version: J! 2.5,9
  • MySQL version: 5.1
  • PHP version: 5.3.24
FIXED: API Explorer results panel in Joomla
May 25, 2012, 01:47:42 pm
ok got it.

after
restURL = '{crmURL p="civicrm/ajax/rest"}';

can you add
restURL = restURL.replace("&","&"); // J! fix CRM-xxx

works a treat now.  Thanks Xavier - I owe you a pint (how many times have you heard that), cheers!

Case raised http://issues.civicrm.org/jira/browse/CRM-10270


xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: FIXED: API Explorer results panel in Joomla
May 27, 2012, 02:44:20 am
Quote from: speleo on May 25, 2012, 01:47:42 pm

works a treat now.  Thanks Xavier - I owe you a pint (how many times have you heard that), cheers!

Cool. See you in london for after drink at civicon in sept ;)

Quote from: speleo on May 25, 2012, 01:47:42 pm
Case raised http://issues.civicrm.org/jira/browse/CRM-10270

Fixed
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • API Explorer results panel in Joomla

This forum was archived on 2017-11-26.