# Http trace for a post

**URL:** <https://meta.discourse.org/t/http-trace-for-a-post/62993>\
**Category:** Development\
**Created:** [19 Maggio 2017, 2:45am UTC](https://meta.discourse.org/t/http-trace-for-a-post/62993 "2017-05-19T02:45:05Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)\
**Post date:** [19 Maggio 2017, 1:10pm UTC](https://meta.discourse.org/t/http-trace-for-a-post/62993/4 "2017-05-19T13:10:52Z")

</div>

> [@gchiu](#):
>
> I presume that the body of the post contains form data.
> 
> but then the example for POST shows it instead as JSON

Sorry for any confusion in the docs. Yes it is showing the example body as JSON mostly just for readability but yes you can create the request as form-data

> [@gchiu](#):
>
> Also the api target for a post seems to be /posts but other sites says it’s /posts.json

They are ambiguous, are the same endpoint and will accept the exact same POST body. If the default happens to return JSON then I usually just leave off the `.json`. Some endpoints that don’t have the extension will return html instead.

> [@gchiu](#):
>
> but that post told me that I also need to include the api\_key and api\_name in the URL!

That would work, but it actually said:

> [@riking](#):
>
> api\_key and api\_username are POST parameters, not headers.

so you can put the api\_key and api\_username in the POST body not in the header.

Here is an example curl command for creating a post on a topic:

```
curl -X POST \
"http://localhost:3000/posts" \
-H "Content-Type: multipart/form-data;" \
-F "api_key=f10bc7457666b1b3b18e7a85e73b975e7010ed3b049e6092199dfc3c4f99763c" \
-F "api_username=system" \
-F "topic_id=12" \
-F "raw=102c406c-54eb-450e-aba4-1ea0a4d0d328 102c406c-54eb-450e-aba4-1ea0a4d0d328 102c406c-54eb-450e-aba4-1ea0a4d0d328"

```

---

_[View the full topic](https://meta.discourse.org/t/http-trace-for-a-post/62993)._
