Getting individual items from a JSON payload from Pocket API

Trying to build some Pocket https://getpocket.com integration need help with data

What is the error message (if any)?

Need Code node help

Please share the workflow

Sharing the output that needs to be transformed

The Pocket API returns the following data - it seems to be just JSON and not any array for each individual item (the items hava unique number and the filed in them called item_id which separates the items) (A sample response of 2 items are listed below).
I would like some help with how to extract each item in the JSON to be a n8n item.
I already tried the Split items but the JSON doesnt have the item data in an array so that failed.

Spent a few hours building the Pocket OAuth and now giving up after a few hours and asking for help - help me please as I have limited JS/JSON/Array understanding

[
  {
    "status": 1,
    "complete": 1,
    "list": {
      "3219666024": {
        "item_id": "3219666024",
        "resolved_id": "3219666024",
        "given_url": "https://hurl.dev/",
        "given_title": "",
        "favorite": "0",
        "status": "0",
        "time_added": "1669404406",
        "time_updated": "1669404411",
        "time_read": "0",
        "time_favorited": "0",
        "sort_id": 0,
        "resolved_title": "Run and Test HTTP Requests",
        "resolved_url": "https://hurl.dev/",
        "excerpt": "Hurl is a command line tool that runs HTTP requests defined in a simple plain text format. It can chain requests, capture values and evaluate queries on headers and body response. Hurl is very versatile: it can be used for fetching data, testing HTTP sessions and testing XML / JSON APIs.",
        "is_article": "0",
        "is_index": "1",
        "has_video": "0",
        "has_image": "0",
        "word_count": "50",
        "lang": "en",
        "tags": {
          "testing": {
            "item_id": "3219666024",
            "tag": "testing"
          }
        },
        "listen_duration_estimate": 19
      },
      "3721207649": {
        "item_id": "3721207649",
        "resolved_id": "3721207649",
        "given_url": "https://github.com/stepci/stepci",
        "given_title": "",
        "favorite": "0",
        "status": "0",
        "time_added": "1669306761",
        "time_updated": "1669306769",
        "time_read": "0",
        "time_favorited": "0",
        "sort_id": 1,
        "resolved_title": "stepci/stepci",
        "resolved_url": "https://github.com/stepci/stepci",
        "excerpt": "Welcome Step CI is an open-source tool, which makes testing and monitoring APIs simple Quick overview: Language-agnostic. Flexible, declarative configuration language REST, GraphQL, XML Integrated.",
        "is_article": "1",
        "is_index": "1",
        "has_video": "0",
        "has_image": "1",
        "word_count": "235",
        "lang": "en",
        "top_image_url": "https://repository-images.githubusercontent.com/537500924/1077356a-7c24-4617-9108-adad13b18fef",
        "tags": {
          "api": {
            "item_id": "3721207649",
            "tag": "api"
          },
          "testing": {
            "item_id": "3721207649",
            "tag": "testing"
          }
        },
        "authors": {
          "173257241": {
            "item_id": "3721207649",
            "author_id": "173257241",
            "name": "mishushakov",
            "url": "https://github.com/stepci/stepci/commits?author=mishushakov"
          }
        },
        "image": {
          "item_id": "3721207649",
          "src": "https://camo.githubusercontent.com/098ae6e60b151f4a1ea33928f09878ca0b2aa0ed74267b4a892fad9d8ed90ad9/68747470733a2f2f692e696d6775722e636f6d2f44694d334771672e706e67",
          "width": "0",
          "height": "0"
        },
        "images": {
          "1": {
            "item_id": "3721207649",
            "image_id": "1",
            "src": "https://camo.githubusercontent.com/098ae6e60b151f4a1ea33928f09878ca0b2aa0ed74267b4a892fad9d8ed90ad9/68747470733a2f2f692e696d6775722e636f6d2f44694d334771672e706e67",
            "width": "0",
            "height": "0",
            "credit": "",
            "caption": ""
          }
        },
        "domain_metadata": {
          "name": "GitHub",
          "logo": "https://logo.clearbit.com/github.com?size=800",
          "greyscale_logo": "https://logo.clearbit.com/github.com?size=800&greyscale=true"
        },
        "listen_duration_estimate": 91
      }
    },
    "error": null,
    "search_meta": {
      "search_type": "normal"
    },
    "since": 1669996177
  }
]

Share the output returned by the last node

Information on your n8n setup

  • n8n version:0.204.0
  • Database you’re using (default: SQLite):
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]:docker

Hey @treyr,

Give the workflow below a go, I think it should be doing what you are after which is giving you an output like this:

1 Like

Thanks @Jon - it worked like … Magic !
I will add to the Pocket integration thread for others

I hate to impose @jon - you have been amazing but I could use a little more help
I am trying to use similar code to now extract all the tags in each entry.
I tried jmespath and $iput.all() etc but my limited JS knowledge is killing me.

Tags Snippet

I moved on to Raindrop.io - much better than Pocket !

1 Like

Hey @treyr,

Just to be complete… Below is the same workflow but tweaked to only return the tags.

Thank you !

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.