0

I am trying to display information regarding Contributed modules available on Drupal programmatically.

For that, I am taking the help of this documentation : https://www.drupal.org/drupalorg/docs/apis/rest-and-other-apis

When I am calling API like: https://www.drupal.org/api-d7/node.json?field_project_machine_name=ctools

In return I am receiving a JSON object with the following details:

"field_supporting_organizations": [
                {
                    "uri": "https://www.drupal.org/api-d7/field_collection_item/1381907",
                    "id": "1381907",
                    "resource": "field_collection_item"
                }
],

Now, I want to extract more data on this field collection item, but I am unable to find the right API filters to do so.

Any help would be much appreciated.

1 Answer 1

2

To extrach more information from that field collection item, you just use the URI reported from that JSON data, but appending .json to the URI.
In your case, the URI is https://www.drupal.org/api-d7/field_collection_item/1381907.json, which returns the following data.

{
  "field_how_they_helped": "Maintenance",
  "field_supporting_organization": {
    "uri": "https://www.drupal.org/api-d7/node/2808667",
    "id": "2808667",
    "resource": "node"
  },
  "item_id": "1381907",
  "revision_id": "1675252",
  "field_name": "field_supporting_organizations",
  "archived": "0",
  "url": "https://www.drupal.org/field-collection/field-supporting-organizations/1381907",
  "host_entity": {
    "uri": "https://www.drupal.org/api-d7/node/343333",
    "id": "343333",
    "resource": "node"
  },
  "feeds_item_guid": null,
  "feeds_item_url": null,
  "feed_nid": null
}

If then you need to get more information about the organization, you visit https://www.drupal.org/api-d7/node/2808667.json, which returns the following data.

{
  "body": {
    "value": "<p>The University of British Columbia is a global centre for research and teaching, consistently ranked among the top 20 public universities in the world. Since 1915, UBC’s entrepreneurial spirit has embraced innovation and challenged the status quo. UBC encourages its students, staff and faculty to challenge convention, lead discovery and explore new ways of learning. At UBC, bold thinking is given a place to develop into ideas that can change the world.</p>",
    "summary": "",
    "format": "1"
  },
  "taxonomy_vocabulary_48": [],
  "taxonomy_vocabulary_50": [
    {
      "uri": "https://www.drupal.org/api-d7/taxonomy_term/24656",
      "id": "24656",
      "resource": "taxonomy_term"
    }
  ],
  "taxonomy_vocabulary_52": [
    {
      "uri": "https://www.drupal.org/api-d7/taxonomy_term/24104",
      "id": "24104",
      "resource": "taxonomy_term"
    }
  ],
  "field_budget": "",
  "field_contributions": {
    "value": "<p>Web services offer Drupal integration to the faculty and staff and they have provided a theme and commerce payment gateway integration module. Also have staff members contribute to Drupal and meetups for users within the University staff.</p>",
  "format": "1"
  },
  "field_link": {
    "url": "https://www.ubc.ca",
    "attributes": [],
    "display_url": null
  },
  "field_logo": {
    "file": {
      "uri": "https://www.drupal.org/api-d7/file/5711845",
      "id": "5711845",
      "resource": "file"
    },
    "alt": "The University of British Columbia",
    "title": ""
  },
  "field_org_marketplace_request": false,
  "field_org_training_request": false,
  "field_organization_headquarters": "Vancouver",
  "field_organization_list_rule": "never",
  "field_organization_training_desc": {
    "value": "",
    "format": "1"
  },
  "field_organization_training_list": "off",
  "field_organization_training_url": {
    "url": "",
    "attributes": [],
    "display_url": null
  },
  "field_organization_technologies": "off",
  "field_organization_support": [],
  "field_short_description": null,
  "field_hosting_type": [],
  "field_org_issue_credit_count": "12",
  "field_organization_type": {
    "uri": "https://www.drupal.org/api-d7/taxonomy_term/182533",
    "id": "182533",
    "resource": "taxonomy_term"
  },
  "field_org_membership_status": null,
  "field_organization_loc_served": [],
  "nid": "2808667",
  "vid": "10103871",
  "is_new": false,
  "type": "organization",
  "title": "The University of British Columbia",
  "language": "en",
  "url": "https://www.drupal.org/the-university-of-british-columbia",
  "edit_url": "https://www.drupal.org/node/2808667/edit",
  "status": "1",
  "promote": "0",
  "sticky": "0",
  "created": "1475153665",
  "changed": "1623042361",
  "author": {
    "uri": "https://www.drupal.org/api-d7/user/160302",
    "id": "160302",
    "resource": "user"
  },
  "book_ancestors": [],
  "comment": "1",
  "comments": [],
  "comment_count": "0",
  "comment_count_new": false,
  "feeds_item_guid": null,
  "feeds_item_url": null,
  "feed_nid": null,
  "flag_flag_tracker_follow_user": [],
  "flag_tracker_follower_count": null,
  "has_new_content": null,
  "last_comment_timestamp": "1475153665",
  "projects_supported": [
    {
      "id": "3054475",
      "title": "Maintainer Support",
      "uri": "https://www.drupal.org/api-d7/node/3054475"
    },
    {
      "id": "2920939",
      "title": "Responsive Table Filter",
      "uri": "https://www.drupal.org/api-d7/node/2920939"
    },
    {
      "id": "2724893",
      "title": "Composer Deploy",
      "uri": "https://www.drupal.org/api-d7/node/2724893"
    },
    {
      "id": "2632164",
      "title": "Twig Extensions",
      "uri": "https://www.drupal.org/api-d7/node/2632164"
    },
    {
      "id": "2162097",
      "title": "Views Selective Filters",
      "uri": "https://www.drupal.org/api-d7/node/2162097"
    },
    {
      "id": "1612464",
      "title": "SAML Service Provider",
      "uri": "https://www.drupal.org/api-d7/node/1612464"
    },
    {
      "id": "1378306",
      "title": "Entityform",
      "uri": "https://www.drupal.org/api-d7/node/1378306"
    },
    {
      "id": "1173784",
      "title": "Node authorize link",
      "uri": "https://www.drupal.org/api-d7/node/1173784"
    },
    {
      "id": "948986",
      "title": "Menu Position",
      "uri": "https://www.drupal.org/api-d7/node/948986"
    },
    {
      "id": "756434",
      "title": "Form Tips",
      "uri": "https://www.drupal.org/api-d7/node/756434"
    },
    {
      "id": "460628",
      "title": "Views Natural Sort",
      "uri": "https://www.drupal.org/api-d7/node/460628"
    },
    {
      "id": "343333",
      "title": "Chaos Tool Suite (ctools)",
      "uri": "https://www.drupal.org/api-d7/node/343333"
    },
    {
      "id": "265945",
      "title": "Menu Block",
      "uri": "https://www.drupal.org/api-d7/node/265945"
    },
    {
      "id": "165016",
      "title": "Editable Fields",
      "uri": "https://www.drupal.org/api-d7/node/165016"
    },
    {
      "id": "161539",
      "title": "Views Bulk Operations (VBO)",
      "uri": "https://www.drupal.org/api-d7/node/161539"
    },
    {
      "id": "92594",
      "title": "Calendar",
      "uri": "https://www.drupal.org/api-d7/node/92594"
    },
    {
      "id": "74958",
      "title": "Panels",
      "uri": "https://www.drupal.org/api-d7/node/74958"
    },
    {
      "id": "9044",
      "title": "Code Filter",
      "uri": "https://www.drupal.org/api-d7/node/9044"
    }
  ]
}

In general, to access the URI returned from that data, you need to append .json to the URI. For example, for https://www.drupal.org/api-d7/taxonomy_term/24656, you use https://www.drupal.org/api-d7/taxonomy_term/24656.json.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.