技术小黑屋

curl发送POST请求

curl发送POST请求 今天写Gitlab的一个merge request hook,使用curl来简化测试请求.简单备忘一下,如何使用curl发送POST请求.以下为使用curl发送一个携带json数据的POST请求.

命令介绍

-H, —header LINE Custom header to pass to server (H)
-d, —data DATA HTTP POST data (H)

示例命令

1
curl -H "Content-Type: application/json" -d '{"object_kind":"merge_request","object_attributes":{"id":22,"target_branch":"master","source_branch":"master","source_project_id":57,"author_id":9,"assignee_id":null,"title":"Master Title","created_at":"2014-07-02T02:31:20.000Z","updated_at":"2014-07-02T02:36:33.008Z","milestone_id":null,"state":"closed","merge_status":"unchecked","target_project_id":55,"iid":7,"description":"description_content"}}' http://10.0.6.122:9002/merge_request

推荐





快来解锁最新版 Typora,新用户券后仅需 84 元!
如何便宜的购买 office 365 ?
新版赤友 NTFS 助手来袭,正版超低价