2022-02-20 02:13:33 +01:00
|
|
|
---
|
|
|
|
title: post
|
|
|
|
layout: command
|
|
|
|
version: 0.59.0
|
|
|
|
---
|
2022-02-18 19:53:10 +01:00
|
|
|
|
2022-02-20 02:13:33 +01:00
|
|
|
Post a body to a URL (HTTP POST operation).
|
|
|
|
|
|
|
|
## Signature
|
|
|
|
|
2022-02-20 21:20:41 +01:00
|
|
|
```> post (path) (body) --user --password --content-type --content-length --headers --raw --insecure```
|
2022-02-18 19:53:10 +01:00
|
|
|
|
|
|
|
## Parameters
|
2022-02-20 02:13:33 +01:00
|
|
|
|
|
|
|
- `path`: the URL to post to
|
|
|
|
- `body`: the contents of the post body
|
|
|
|
- `--user {any}`: the username when authenticating
|
|
|
|
- `--password {any}`: the password when authenticating
|
|
|
|
- `--content-type {any}`: the MIME type of content to post
|
|
|
|
- `--content-length {any}`: the length of the content being posted
|
2022-02-21 14:38:15 +01:00
|
|
|
- `--headers {any}`: custom headers you want to add
|
2022-02-20 02:13:33 +01:00
|
|
|
- `--raw`: return values as a string instead of a table
|
|
|
|
- `--insecure`: allow insecure server connections when using SSL
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
Post content to url.com
|
|
|
|
```shell
|
|
|
|
> post url.com 'body'
|
|
|
|
```
|
|
|
|
|
|
|
|
Post content to url.com, with username and password
|
|
|
|
```shell
|
|
|
|
> post -u myuser -p mypass url.com 'body'
|
|
|
|
```
|
2022-02-18 19:53:10 +01:00
|
|
|
|
2022-02-20 21:20:41 +01:00
|
|
|
Post content to url.com, with custom header
|
|
|
|
```shell
|
|
|
|
> post -H [my-header-key my-header-value] url.com
|
|
|
|
```
|
|
|
|
|