Giter Club home page Giter Club logo

insomnia-plugin-query's Introduction

Query Plugin

About

This plugin adds query template tag to your Insomnia, which can provide values from requests or responses, using a LinQ-like query syntax.

How to install

Using Insomnia Hub: You can navigate to Insomnia Plugin Hub Page and search for Query plugin, Open the details page and click Install Plugin button. This throw an installation link which you can open with your insomnia on your desktop.

Directly installing the zip file:: You can download project zip file from github. Then extract the content into a directory at your insomnia's plugin's directory.

Using Insomnia Application: You can Open your insomnia application, go to Preferences menu, open the plugins tab and enter the name insomnia-plugin-query into text box, the click Install Plugin button.

How to use

By clicking the created template tag, you can edit parameters:

  • Target Request: the request which would be searched for values.
  • Json Query: This would be a query you write to find your target field
  • Trigger Behavior: Here you can select whether or not to re send the target request.

Consider you have the following response for a request to Json Place Holder

[
  {
    "userId": 1,
    "id": 1,
    "title": "delectus aut autem",
    "completed": false
  },
  {
    "userId": 1,
    "id": 2,
    "title": "quis ut nam facilis et officia qui",
    "completed": false
  },
  {
    "userId": 1,
    "id": 3,
    "title": "fugiat veniam minus",
    "completed": false
  },
  {
    "userId": 1,
    "id": 4,
    "title": "et porro tempora",
    "completed": true
  },
  {
    "userId": 1,
    "id": 5,
    "title": "laboriosam mollitia et enim quasi adipisci quia provident illum",
    "completed": false
  }
]

and now you want to find the id for an item with the title fugiat veniam minus. For that, you can write a query like: $.(@title == 'fugiat veniam minus').id. This query would be evaluated to 3.

$ means the whole response/request data. you can go one step deeper into the data structure with a dot. Or you can put a query using parentheses. when writing a query, you would provide an binary condition which might be true for a number of items. in this case, the first matching item would be selected. then you can keep going deeper to select the target field from the item.

In the given example, @title == 'fugiat veniam minus' selects items with title equal to 'fugiat veniam minus',then the .id part will select it's id property, therefor the Query template tag will be evaluated to 3.

insomnia-plugin-query's People

Contributors

acidmanic avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.