# Simple API Post to update variable

**URL:** <https://discourse.nodered.org/t/simple-api-post-to-update-variable/36962>\
**Category:** General\
**Created:** [3 December 2020 18:54 UTC](https://discourse.nodered.org/t/simple-api-post-to-update-variable/36962 "2020-12-03T18:54:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SeRiusRod](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@SeRiusRod](https://discourse.nodered.org/u/SeRiusRod)\
**Post date:** [3 December 2020 18:54 UTC](https://discourse.nodered.org/t/simple-api-post-to-update-variable/36962/1 "2020-12-03T18:54:38Z")

</div>

I want to update a flow context variable through an external API call. For this I used the Http In node configured as [POST] for /myapi/myvar.  
Then I launch a curl call like:  
`curl http://myserver:1880/myapi/myvar -d "myvar=true"` (I also tried --data=true)

And somewhat I expected to get "true" in my payload. But instead I get { myvar: "true"}  
Is it something with the curl command? Is it possible to directly get the value in payload?

---

<div class="post-metadata">

**Author:** ![SeRiusRod](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@SeRiusRod](https://discourse.nodered.org/u/SeRiusRod)\
**Post date:** [3 December 2020 19:05 UTC](https://discourse.nodered.org/t/simple-api-post-to-update-variable/36962/2 "2020-12-03T19:05:20Z")

</div>

Ok, I found myself. The curl format should be something like:  
`curl -X POST -d 'true' -H "Content-type: text/plain" http://myserver:1880/myapi/myvar`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [1 February 2021 19:05 UTC](https://discourse.nodered.org/t/simple-api-post-to-update-variable/36962/3 "2021-02-01T19:05:22Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
