2

Im currently using Drupal's http client manager module to pull data from a json endpoint. I am having trouble getting this to work for a nested structure like this.

{
  count: 2431
  page_info: []
  content:
    0:
      id: 1
      title: "Ipsum lorem"
    1:
      id: 2
      title: "dolor set"
}

The service description looks like this.

operations:
  GetEvents:
    httpMethod: "GET"
    uri: "8892e8de"
    summary: "Gets the available Posts."
    responseClass: "PostsList"

models:
  Posts:
    type: "object"
    location: "json"
    properties:
      content:
        location: "json"
        type: "array"

  PostsList:
    type: "array"
    location: "json"
    items:
      "$ref": "Posts"

This is returning an empty object of arrays and not picking up any data.

How can I access the nested data?

2
  • It could be because the example you supplied is not valid json and can not be parsed when retrieved.
    – CG Monroe
    Commented Feb 24, 2021 at 21:32
  • Hi Tnum, were you able to find the solution ? trying to do something similar. Commented Mar 16, 2021 at 16:43

0

Your Answer

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

Browse other questions tagged or ask your own question.