Grafik so'rovini qanday qilib pochta orqali jo'natish mumkin?

Men foydalanaman

POST type
URL http://######/graphql
Body: 
query: "query: "{'noteTypes':  {'name', 'label', 'labelColor', 'groupName', 'groupLabel', 'imageUrl'}}"

But it return "message": "Must provide query string."

29

7 javoblar


There's a better way to do it using the REST client Insomnia

Docs are here, how to send graphql queries: https://support.insomnia.rest/article/61-graphql


Quyida postman uchun qadamlar mavjud

Step 1.

Chrome'da GraphiQL'ni ishga tushiring, Chrome Dev Konsolini oching, Tarmoq yorlig'ini bosing va so'rovni grafik yorlig'idan qiling, so'rovni bajarganingizda, tarmoq yorlig'ida grafik so'rovi ko'rsatiladi ...

enter image description here

Step 2.

From the graphql request copy the request query, Select the Copy as cURL (cmd)

enter image description here

Step 3.

Open Postman, In the Top-Left click on the Import button, after you click Import you have to click the Paste Raw Text, and paste the copied cURL request as done in step2 after it's done click the Import

enter image description here

Step 4.

Pochta xabarchisi Grafik so'rovini yuborish uchun tayyor, Send tugmachasini bosib, tanadagi javob qutisiga Response

enter image description here

Step 5.

So'rov qanday yuborilayotganligini ko'rish uchun Headers ning yonidagi Body yorlig'ini bosing, siz postlarni JSON formatida qanday qilib berishni bilib olasiz.

e.g: edges {\n node {\n id\n jobId\n }\n, If you want to view another field then you need to add it in with the suffix \n

like if need name then : edges {\n node {\n id\n jobId\n name\n }\n

\n here just means to represent a new line. Instead, you can make it simpler by providing a clear and illustrative JSON like below

=============================================== ============================

Note: The body type must be raw with application/json content-type. So, the query must be a valid JSON with quotes ".."

{  
   "query":"{viewer {user {edges {node {id jobId name }}}}}"
}

=============================================== ============================

enter image description here

so'rovni badanga qanday yuborishni bilsangiz, 5-qadam dan to'g'ridan-to'g'ri boshlashingiz mumkin so'rovini bajarishda talab qilinishi kerak bo'lgan boshqa narsalar ham

enter image description here

Soddalashtirilgan JSON bilan

enter image description here

65
qo'shib qo'ydi
Albatta, postman grafika uchun foydali emas, biz postman ekranlari bilan grafig kerak
qo'shib qo'ydi muallif stackdave, manba
Xuddi shu qadamlarni ishlatishda foydalanayapman :, Curl import qilishda xatolik: 2option-kam argumentlar topildi. Faqat bittasi qo'llab-quvvatlanadi (URL)
qo'shib qo'ydi muallif Ankit Gupta, manba
Qo'rqoq, hmong uchun rahmat
qo'shib qo'ydi muallif zhulinpinyu, manba
Ajablanarlisi! Ajablanarlisi!
qo'shib qo'ydi muallif Viktor Pavlenko, manba

Buni mavzu bo'yicha izlayotgan har bir kishi uchun qo'shib qo'yishingiz mumkin ... Agar siz Graphuzzli qo'ng'iroqlarni uyqusizlik bilan yanada yaxshiroq va osonroq ishlatishingiz mumkin:

https://insomnia.rest

GraphQLni ishlab chiqishda hayratga tushdi.

17
qo'shib qo'ydi
Rahmat! GraphQL bilan bog'liq doc: support.insomnia.rest/article/61-graphql
qo'shib qo'ydi muallif Sebabouche, manba

UPDATE 2:

POSTMAN bu amaliy foydalanish emas, chunki ular hali ko'p vaqt talab etadigan sarlavhalarni qo'shishning oson usulida ishlaydi va POSTMAN grafika bilan ishlash uchun tabiiy ravishda ishlamaydi,

you can follow the progress about that here: https://github.com/postmanlabs/postman-app-support/issues/1669

Quyidagi kabi boshqa paketlar plaginini ishlatishni tavsiya etaman:

the best (like postman , but profile and sync price 5$ monthly):
   https://insomnia.rest/
others:
   https://github.com/andev-software/graphql-ide
   https://github.com/imolorhe

grafika uchun (bosh sarlavhalarini qo'shish imkoniyati yo'q) siz uchta narsani kiritishingiz kerak (u oson emas):

  1. Header:

    Content-Type: application/json

  2. Body:

    Choose Ray < optiongroup

    Choose JSON (application/json) < selectbox

  3. Compose JavaScript object with "query" and the "value" of your graph query. Like all objects in JS it'sneeded the propery and the value , in this case "quote" is the property, the value must be with double quotes. Inside the value (graphl string) you dont compose JS objects, so you dont need use doble quotes, it's just a string.

    {"query":"{ allQuotes { text } }" }

    the problem is you need type all in a single line, no like grapIql... there is a post requirement in postman github so is easy work with graphql:

enter image description here

enter image description here

9
qo'shib qo'ydi

https://github.com/postmanlabs/postman-app-support/issues/ sahifasidan 2390 dasturidan foydalanish uchun oldindan so'rovdan foydalanish mumkin.

Step 1.

Buyurtmachining javobi foydali yuk uchun to'ldiruvchini qo'yadi.

{
    "query":{{query}}
}

Step 2.

Pre-spam-buyruq faylida foydali yukni yarating va uni atrof-muhit o'zgaruvchisida saqlang.

postman.setEnvironmentVariable("query", JSON.stringify(
`
{
  search(query: "test", type: ISSUE, first: 10) {
    issueCount
    edges {
      node {
        ... on Issue {
          title
          id
          state
          closed
          repository {
            name
          }
        }
      }
    }
  }
}
`
));
9
qo'shib qo'ydi
Bu jozibasi kabi ishlaydi va oldingi javoblarda tasvirlangan barcha qadamlardagi qiyinchiliklarni boshdan kechiradi! Rahmat.
qo'shib qo'ydi muallif Alexis.Rolland, manba

You don't need INSOMNIA in case the GraphQL server responds to Content-type: application/graphql or postman.setEnvironmentVariable,

Shunchaki bajargin:

In Headers tab: Content-Type: application/graphql

Body tabida tanlangan "xom" so'rovingizni qo'ying

enter image description here

8
qo'shib qo'ydi

Agar graphQl so'rovini POSTMAN dan foydalangan holda ishlatishga harakat qilsam, POSTMAN da json bilan satrda ma'lumotlarini yuboring.

So'rovlar buyrug'i:

{"query":"{user(id:902){id,username,DOB}}"}

Mutatsiyalar buyrug'i:

{ "query": "mutation {createMutations(reviewer:36, comments:\"hello\",data_id: 1659, approved: true ){id}}" }

       #commnent: String Type
       #data_id:Int Type
       #approved:Boolean Type
2
qo'shib qo'ydi

Checkout https://github.com/hasura/graphqurl - curl for GraphQL:

  • Grafik so'rovlarini autocomplete bilan bajarish uchun CLI
  • Grafik chizig'ini har qanday so'nggi nuqtadan mahalliy ravishda boshqaring (maxsus sarlavhalar bilan)
  • Nodejs yoki brauzer bilan kutubxona sifatida foydalanish
  • Obunalarni qo'llab-quvvatlaydi

Men mualliflardan biri.

gq https://gentle-anchorage-72051.herokuapp.com/v1alpha1/graphql -i

GraphiQL with headers

0
qo'shib qo'ydi