class Playwright::APIRequestContext
def post(
})
},
"buffer": b"console.log(2022);",
"mimeType": "text/javascript",
"name": "f.js",
"fileField": {
multipart={
"https://example.com/api/uploadScrip'",
api_request_context.post(
```python
The common way to send file(s) in the body of a request is to upload them as form fields with `multipart/form-data` encoding. You can achieve that with Playwright API like this:
```
api_request_context.post("https://example.com/api/findBook", form=formData)
}
"body": "John Doe",
"title": "Book Title",
formData = {
```python
To send form data to the server use `form` option. Its value will be encoded into the request body with `application/x-www-form-urlencoded` encoding (see below how to use `multipart/form-data` form encoding to send files):
```
api_request_context.post("https://example.com/api/createBook", data=data)
}
"body": "John Doe",
"title": "Book Title",
data = {
```python
JSON objects can be passed directly to the request:
**Usage**
context cookies from the response. The method will automatically follow redirects.
The method will populate request cookies from the context and update
Sends HTTP(S) [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) request and returns its response.
def post( url, data: nil, failOnStatusCode: nil, form: nil, headers: nil, ignoreHTTPSErrors: nil, maxRedirects: nil, multipart: nil, params: nil, timeout: nil) wrap_impl(@impl.post(unwrap_impl(url), data: unwrap_impl(data), failOnStatusCode: unwrap_impl(failOnStatusCode), form: unwrap_impl(form), headers: unwrap_impl(headers), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), maxRedirects: unwrap_impl(maxRedirects), multipart: unwrap_impl(multipart), params: unwrap_impl(params), timeout: unwrap_impl(timeout))) end