use curl for API query, post and delete

  1. QUERY
    $ curl http://localhost:5000/student/
    $ curl http://localhost:5000/student/?page=1
    $ curl http://localhost:5000/student/?class=1&age=19

  2. UPDATE
    $ curl -X POST -d ‘{"name": "Lily", "age": 17, "class":1, "profile":"Likely"}’ -H "Content-Type: application/json" http://127.0.0.1:5000/student/
    {"age":17,"class":"1","id":8,"name":"Lily","profile":"Likely"}

$ curl -X PATCH -d ‘{"class":3}’ -H "Content-Type: application/json" http://127.0.0.1:5000/student/1
{"age":18,"class":"3","id":1,"name":"\u5f20\u4e09","profile":"\u64c5\u957f\u5b66\u4e60"}

  1. DELETE
    $ curl -X DELETE -H "Content-Type: application/json" http://127.0.0.1:5000/student/8

  2. OTHERS (meta and export)
    $ curl http://127.0.0.1:5000/student/meta
    $ curl -o student.csv http://127.0.0.1:5000/student/?export

Curl Cookbook: https://catonmat.net/cookbooks/curl

18 Replies to “use curl for API query, post and delete”

  1. Hey there. I found your website by way of Google at the same time as searching for a similar subject, your site got here up. It seems great. I have bookmarked it in my google bookmarks to come back then. Leda Linus Madeline

  2. I am very happy to read this. This is the kind of manual that needs to be given and not the random misinformation that is at the other blogs. Appreciate your sharing this best doc. Tiphanie Rodrick Clarice

  3. Hello! This is my 1st comment here so I just wanted to give a quick shout out and tell you I genuinely enjoy reading your articles. Can you suggest any other blogs/websites/forums that deal with the same subjects? Thanks! Merrilee Ransom Rabjohn

  4. Hey there. I found your blog via Google at the same time as looking for a similar topic, your site got here up. It appears great. I have bookmarked it in my google bookmarks to come back then. Gilda Whit Cornell

  5. You actually make it seem so easy together with your presentation but I to find this matter to be really something which I think I might never understand. It kind of feels too complex and extremely wide for me. I am looking forward for your next put up, I will attempt to get the dangle of it! Brooks Abramo Townshend

  6. You need to be described as a section of a competition for starters of the highest-quality sites on the net. I most definitely can suggest this web site!|You must be considered a part of a competition for one of the best quality sites on the net. I most certainly can suggest this internet site! Aurore Rossy Scammon

  7. I think this is among the most important info for me. And i’m glad reading your article. But should remark on some general things, The site style is ideal, the articles is really great : D. Good job, cheers| Wanda Rem Luis

Leave a Reply

Your email address will not be published. Required fields are marked *