zet.oliverdavies.uk/source/_zets/24.md

17 lines
444 B
Markdown
Raw Normal View History

2024-09-14 12:39:01 +00:00
---
title: POSTing data from a JSON file
date: 2024-09-14 13:39:01
tags: [Linux, curl]
related:
- Sending POST requests with curl
2024-09-14 15:57:43 +00:00
use: [zets]
2024-09-14 12:39:01 +00:00
---
When sending JSON data in a POST request, instead of writing it inline with the `--data` or `--json` option, a filename can be entered - prefixed with an `@` symbol.
For example, to POST the data from a data.json file:
```shell
curl --insecure --json @data.json https://mysite.com/webhook
```