0

I'm running the following command inside a docker container:

curl 'https://demo.cachethq.io/API/v1/components?name=Blog' | tac | tac | jq '.'

But I get null output (after the curl progress bar) Running without the final jq command gives the correct json. Any help would be appreciated (The tac is to stop the curl output ending before the jq)

3
  • Double-check the URL you're using. As written in your question, the URL returns an HTML page noting the resource couldn't be found. I checked the docs for cachet, and the URL is listed there as all lower-case (you have ".../API/...", rather than ".../api/..."). I tried the lower-case version and it works as expected, including when piped to jq. Commented Nov 2, 2016 at 23:42
  • Yeah, I'm forced to type into my phone today and mistyped - Rao is correct. However I still don't get out from jq, but the output from tac is still good Commented Nov 3, 2016 at 5:33
  • Ok, finally figured what was going wrong here... I had installed jq from npm. Turns out this is a completely different package, something to do with jquery. Once I installed from brew it worked perfectly. Stupid name overlaps... :( Commented Nov 15, 2016 at 0:02

1 Answer 1

1

It is trivial error.

Please change the url from:

curl 'https://demo.cachethq.io/API/v1/components?name=Blog' | tac | tac | jq '.'

To:

curl 'https://demo.cachethq.io/api/v1/components?name=Blog' | tac | tac | jq '.'

Output:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   426    0   426    0     0    176      0 --:--:--  0:00:02 --:--:--   176
{
  "meta": {
    "pagination": {
      "total": 1,
      "count": 1,
      "per_page": 20,
      "current_page": 1,
      "total_pages": 1,
      "links": {
        "next_page": null,
        "previous_page": null
      }
    }
  },
  "data": [
    {
      "id": 4,
      "name": "Blog",
      "description": "The Alt Three Blog.",
      "link": "https://blog.alt-three.com",
      "status": 1,
      "order": 0,
      "group_id": 2,
      "created_at": "2016-11-03 01:30:01",
      "updated_at": "2016-11-03 01:30:01",
      "deleted_at": null,
      "enabled": true,
      "status_name": "Operational",
      "tags": {
        "": ""
      }
    }
  ]
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.