Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

NodeBB

  1. Home
  2. uncategorized
  3. Why jq hard (it probably isn't but I am trying to take shortcuts and make a solution that works without knowing too much what I am exactly doing :p)

Why jq hard (it probably isn't but I am trying to take shortcuts and make a solution that works without knowing too much what I am exactly doing :p)

Scheduled Pinned Locked Moved uncategorized
14 Posts 2 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • catraxx@tech.lgbtC catraxx@tech.lgbt

    @MagicLike Process it how? Just adding the json into an array or something?

    magiclike@soc.sekundenklebertransportverbot.deM This user is from outside of this forum
    magiclike@soc.sekundenklebertransportverbot.deM This user is from outside of this forum
    magiclike@soc.sekundenklebertransportverbot.de
    wrote last edited by
    #5

    @catraxx no, taking the JSON out of an API (via curl), then extracting all array objects with a specific value of one property and then extracting a code out of another property in those already extracted objects. Those codes then need to be inserted into a POST request one by one.

    magiclike@soc.sekundenklebertransportverbot.deM catraxx@tech.lgbtC 2 Replies Last reply
    0
    • magiclike@soc.sekundenklebertransportverbot.deM magiclike@soc.sekundenklebertransportverbot.de

      @catraxx no, taking the JSON out of an API (via curl), then extracting all array objects with a specific value of one property and then extracting a code out of another property in those already extracted objects. Those codes then need to be inserted into a POST request one by one.

      magiclike@soc.sekundenklebertransportverbot.deM This user is from outside of this forum
      magiclike@soc.sekundenklebertransportverbot.deM This user is from outside of this forum
      magiclike@soc.sekundenklebertransportverbot.de
      wrote last edited by magiclike@soc.sekundenklebertransportverbot.de
      #6

      @catraxx this resembles somewhat the JSON input I am working with

      {
      ...
      "results": [
      {
      "code": "CODE1",
      ...
      "status": "y",
      ...
      },
      {
      "code": "CODE2",
      ...
      "status": "n",
      ...
      }
      ]
      }
      catraxx@tech.lgbtC 1 Reply Last reply
      0
      • magiclike@soc.sekundenklebertransportverbot.deM magiclike@soc.sekundenklebertransportverbot.de

        @catraxx no, taking the JSON out of an API (via curl), then extracting all array objects with a specific value of one property and then extracting a code out of another property in those already extracted objects. Those codes then need to be inserted into a POST request one by one.

        catraxx@tech.lgbtC This user is from outside of this forum
        catraxx@tech.lgbtC This user is from outside of this forum
        catraxx@tech.lgbt
        wrote last edited by
        #7

        @MagicLike Axios can be used for api communication. If you simply safe the output to a json file you can then just fetch it, which caches the data and you can iterate it normally.

        magiclike@soc.sekundenklebertransportverbot.deM 1 Reply Last reply
        0
        • magiclike@soc.sekundenklebertransportverbot.deM magiclike@soc.sekundenklebertransportverbot.de

          @catraxx this resembles somewhat the JSON input I am working with

          {
          ...
          "results": [
          {
          "code": "CODE1",
          ...
          "status": "y",
          ...
          },
          {
          "code": "CODE2",
          ...
          "status": "n",
          ...
          }
          ]
          }
          catraxx@tech.lgbtC This user is from outside of this forum
          catraxx@tech.lgbtC This user is from outside of this forum
          catraxx@tech.lgbt
          wrote last edited by
          #8

          @MagicLike https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch

          magiclike@soc.sekundenklebertransportverbot.deM 1 Reply Last reply
          0
          • catraxx@tech.lgbtC catraxx@tech.lgbt

            @MagicLike Axios can be used for api communication. If you simply safe the output to a json file you can then just fetch it, which caches the data and you can iterate it normally.

            magiclike@soc.sekundenklebertransportverbot.deM This user is from outside of this forum
            magiclike@soc.sekundenklebertransportverbot.deM This user is from outside of this forum
            magiclike@soc.sekundenklebertransportverbot.de
            wrote last edited by
            #9

            @catraxx okay what is axios o.o
            (I am trying to do all of this in a bash/shell script)

            catraxx@tech.lgbtC 1 Reply Last reply
            0
            • magiclike@soc.sekundenklebertransportverbot.deM magiclike@soc.sekundenklebertransportverbot.de

              @catraxx okay what is axios o.o
              (I am trying to do all of this in a bash/shell script)

              catraxx@tech.lgbtC This user is from outside of this forum
              catraxx@tech.lgbtC This user is from outside of this forum
              catraxx@tech.lgbt
              wrote last edited by
              #10

              @MagicLike In a shell script? I thouught we were talking about jquery because you mentioned javascript earlier. In shell it should be easier?

              magiclike@soc.sekundenklebertransportverbot.deM 1 Reply Last reply
              0
              • catraxx@tech.lgbtC catraxx@tech.lgbt

                @MagicLike https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch

                magiclike@soc.sekundenklebertransportverbot.deM This user is from outside of this forum
                magiclike@soc.sekundenklebertransportverbot.deM This user is from outside of this forum
                magiclike@soc.sekundenklebertransportverbot.de
                wrote last edited by
                #11

                @catraxx okay uhhm I need this to not be JS, but rather independent and preferably just a cronjob-triggered script

                catraxx@tech.lgbtC 1 Reply Last reply
                0
                • magiclike@soc.sekundenklebertransportverbot.deM magiclike@soc.sekundenklebertransportverbot.de

                  @catraxx okay uhhm I need this to not be JS, but rather independent and preferably just a cronjob-triggered script

                  catraxx@tech.lgbtC This user is from outside of this forum
                  catraxx@tech.lgbtC This user is from outside of this forum
                  catraxx@tech.lgbt
                  wrote last edited by
                  #12

                  @MagicLike Right, as i just said, jq means two things lol

                  magiclike@soc.sekundenklebertransportverbot.deM 1 Reply Last reply
                  0
                  • catraxx@tech.lgbtC catraxx@tech.lgbt

                    @MagicLike In a shell script? I thouught we were talking about jquery because you mentioned javascript earlier. In shell it should be easier?

                    magiclike@soc.sekundenklebertransportverbot.deM This user is from outside of this forum
                    magiclike@soc.sekundenklebertransportverbot.deM This user is from outside of this forum
                    magiclike@soc.sekundenklebertransportverbot.de
                    wrote last edited by
                    #13

                    @catraxx heh yeah the js part was the second part of this but now I need to make API calls every few seconds to make the same software even usable for my purpose, the js stuff was just for improved UX 😛

                    1 Reply Last reply
                    0
                    • catraxx@tech.lgbtC catraxx@tech.lgbt

                      @MagicLike Right, as i just said, jq means two things lol

                      magiclike@soc.sekundenklebertransportverbot.deM This user is from outside of this forum
                      magiclike@soc.sekundenklebertransportverbot.deM This user is from outside of this forum
                      magiclike@soc.sekundenklebertransportverbot.de
                      wrote last edited by
                      #14

                      @catraxx

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Login or register to search.
                      Powered by NodeBB Contributors
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups