events-radar / drupal-make

Radar site - Drupal drush makefile
2 stars 1 forks source link

Can't access group events via api #106

Closed aaaaargZombies closed 8 years ago

aaaaargZombies commented 8 years ago

I was hoping to get current events for a few different social centres pulled into a website I was making but I'm receiving mixed/unexpected results from the API. Might be user error? I'll dump some results below. The API docs on your site also mentioned ical feeds but I couldn't spot them either.

Thanks.



GET radar.squat.net/en/api/1.0/search/groups.json?fields[]=title&fields[]=uuid&filter[~and][title]=1 in 12 club
{
    "23268": {
        "title": "1 in 12 Club",
        "uuid": "6c3038bb-a166-4f3e-91e1-0c13b1b0f543"
    }
}
GET radar.squat.net/api/1.0/group_events/6c3038bb-a166-4f3e-91e1-0c13b1b0f543.json
{
    "basePath": "/",
    "pathPrefix": "en/",
    "ajaxPageState": {
        "theme": "at_radar",
        "theme_token": "46EesjeXPXz6E4Y7XfnapsW5QuiRwgJkkKMWEOkQcIs",
        "css": {
            "modules/system/system.base.css": 1,
            "modules/system/system.menus.css": 1,
            "modules/system/system.messages.css": 1,
            "modules/system/system.theme.css": 1,
            "profiles/radar/modules/contrib/date/date_api/date.css": 1,
            "profiles/radar/modules/contrib/date/date_popup/themes/datepicker.1.7.css": 1,
            "profiles/radar/modules/contrib/date/date_repeat_field/date_repeat_field.css": 1,
            "modules/field/theme/field.css": 1,
            "profiles/radar/modules/contrib/logintoboggan/logintoboggan.css": 1,
            "modules/node/node.css": 1,
            "profiles/radar/modules/radar/radar_socialmedia/radar_socialmedia.css": 1,
            "modules/user/user.css": 1,
            "profiles/radar/modules/contrib/date_repeat_entity/date_repeat_entity.css": 1,
            "profiles/radar/modules/contrib/views/css/views.css": 1,
            "profiles/radar/modules/contrib/ctools/css/ctools.css": 1,
            "profiles/radar/modules/contrib/panels/css/panels.css": 1,
            "profiles/radar/themes/adaptivetheme/at_core/css/at.layout.css": 1,
            "profiles/radar/themes/at_radar/css/global.base.css": 1,
            "profiles/radar/themes/at_radar/css/global.styles.css": 1,
            "public://adaptivetheme/at_radar_files/at_radar.responsive.layout.css": 1,
            "public://adaptivetheme/at_radar_files/at_radar.responsive.styles.css": 1,
            "public://adaptivetheme/at_radar_files/at_radar.lt-ie9.layout.css": 1
        },
        "js": {
            "misc/jquery.js": 1,
            "misc/jquery.once.js": 1,
            "misc/drupal.js": 1
        }
    }
}
GET radar.squat.net/api/1.0/group_events/6c3038bb-a166-4f3e-91e1-0c13b1b0f543.json
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
    <head>
        <title>502 Proxy Error</title>
    </head>
    <body>
        <h1>Proxy Error</h1>
        <p>The proxy server received an invalid
response from an upstream server.
            <br />
The proxy server could not handle the request
            <em>
                <a href="/api/1.0/group_events/6c3038bb-a166-4f3e-91e1-0c13b1b0f543.json">GET&nbsp;/api/1.0/group_events/6c3038bb-a166-4f3e-91e1-0c13b1b0f543.json</a>
            </em>.
            <p>
Reason:
                <strong>Error reading from remote server</strong>
            </p>
        </p>
    </body>
</html>

GET radar.squat.net/en/api/1.0/search/groups.json?fields[]=title&fields[]=uuid&filter[~and][title]=sumac centre

{
  "20449": {
    "title": "Sumac Centre",
    "uuid": "21d9360e-3719-4a80-829c-bfff0433733c"
  }
}
GET radar.squat.net/api/1.0/group_events/9b48213f-212f-4799-9430-0499683c3fb8.json
[]

tried with out .json out of curiosity

GET radar.squat.net/api/1.0/group_events/9b48213f-212f-4799-9430-0499683c3fb8

---
ekes commented 8 years ago

More likely Certainly documentation error. I've worked from the PHP reference implementation here. Let me know if it works. Maybe we can then tidy up the documentation.

So for events from "1 in 12 Club" which from the response you posted above I can see is UUID 6c3038bb-a166-4f3e-91e1-0c13b1b0f543 & NID (internal ID) 23268

https://radar.squat.net/api/1.0/search/events.json?facets[city][]=Bradford&facets[group][]=23268 OMG So using the search is the way for everything. But it's the internal ID needed, and argh this really isn't documented because the facet doesn't appear until you have selected a city you have to include that.

What however is 'easy' is you can work out the url by doing the search on the site, so this was just: https://radar.squat.net/en/events/city/Bradford/group/23268 and the path changes from /city/Bradford to facets[city][]=Bradford and so on.

The iCal isn't as rich as the API; and there should be a logo for the iCal feed, but it's lost at the moment. https://radar.squat.net/ical/node/23268 Again it's the internal ID not the UUID :-(

aaaaargZombies commented 8 years ago

Thanks, this is just what I was looking for!

ekes commented 8 years ago

[#107] Documentation required follow-up.