# POST request to dashboard

**URL:** <https://discourse.nodered.org/t/post-request-to-dashboard/77250>\
**Category:** Dashboard\
**Tags:** node-red-dashboard\
**Created:** [4 April 2023 20:21 UTC](https://discourse.nodered.org/t/post-request-to-dashboard/77250 "2023-04-04T20:21:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nichlas](https://avatars.discourse-cdn.com/v4/letter/n/57b2e6/32.png) [@Nichlas](https://discourse.nodered.org/u/Nichlas)\
**Post date:** [4 April 2023 20:21 UTC](https://discourse.nodered.org/t/post-request-to-dashboard/77250/1 "2023-04-04T20:21:21Z")

</div>

Hi i trying to understand how i do a POST request. I use the "http request" and changing "GET" to "POST" and typing in the url [https://api.trafikinfo.trafikverket.se/v2/data.json](https://api.trafikinfo.trafikverket.se/v2/data.json)  
but where do i put my question?  
Is look like this

```auto
<REQUEST>
      <LOGIN authenticationkey="MYkey" />
      <QUERY objecttype="TrainAnnouncement" schemaversion="1.8" orderby="AdvertisedTimeAtLocation">
            <FILTER>
                  <AND>
                        <EQ name="ActivityType" value="Avgang" />
                        <EQ name="LocationSignature" value="Nkv" />
                        <OR>
                              <AND>
                                  
                                    <GT name="AdvertisedTimeAtLocation" value="$dateadd(-00:15:00)" />
                                    <LT name="AdvertisedTimeAtLocation" value="$dateadd(14:00:00)" />
                              </AND>
                              <AND>
                                    <LT name="AdvertisedTimeAtLocation" value="$dateadd(00:30:00)" />
                                    <GT name="EstimatedTimeAtLocation" value="$dateadd(-00:15:00)" />
                              </AND>
                        </OR>
                  </AND>
            </FILTER>
            <INCLUDE>AdvertisedTrainIdent</INCLUDE>
            <INCLUDE>AdvertisedTimeAtLocation</INCLUDE>
            <INCLUDE>TrackAtLocation</INCLUDE>
            <INCLUDE>ToLocation</INCLUDE>
      </QUERY>
</REQUEST>

```

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [4 April 2023 20:46 UTC](https://discourse.nodered.org/t/post-request-to-dashboard/77250/2 "2023-04-04T20:46:41Z")

</div>

> [@Nichlas](#):
>
> but where do i put my question?

In `msg.payload` this will be the body for your request.  
You can use a Template node for this

**Example Flow:**

```auto
[{"id":"6597464adac2b97e","type":"http request","z":"54efb553244c241f","name":"","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://api.trafikinfo.trafikverket.se/v2/data.json","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"Content-Type","keyValue":"","valueType":"other","valueValue":"application/xml"}],"x":620,"y":2380,"wires":[["4cd916d5b0b7430d"]]},{"id":"38ae3ff4ca894356","type":"inject","z":"54efb553244c241f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":250,"y":2380,"wires":[["a98976b0540f7c97"]]},{"id":"a98976b0540f7c97","type":"template","z":"54efb553244c241f","name":"xml","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<REQUEST>\n <LOGIN authenticationkey=\"MYkey\" />\n <QUERY objecttype=\"TrainAnnouncement\" schemaversion=\"1.8\" orderby=\"AdvertisedTimeAtLocation\">\n <FILTER>\n <AND>\n <EQ name=\"ActivityType\" value=\"Avgang\" />\n <EQ name=\"LocationSignature\" value=\"Nkv\" />\n <OR>\n <AND>\n \n <GT name=\"AdvertisedTimeAtLocation\" value=\"$dateadd(-00:15:00)\" />\n <LT name=\"AdvertisedTimeAtLocation\" value=\"$dateadd(14:00:00)\" />\n </AND>\n <AND>\n <LT name=\"AdvertisedTimeAtLocation\" value=\"$dateadd(00:30:00)\" />\n <GT name=\"EstimatedTimeAtLocation\" value=\"$dateadd(-00:15:00)\" />\n </AND>\n </OR>\n </AND>\n </FILTER>\n <INCLUDE>AdvertisedTrainIdent</INCLUDE>\n <INCLUDE>AdvertisedTimeAtLocation</INCLUDE>\n <INCLUDE>TrackAtLocation</INCLUDE>\n <INCLUDE>ToLocation</INCLUDE>\n </QUERY>\n</REQUEST>","output":"str","x":420,"y":2380,"wires":[["6597464adac2b97e"]]},{"id":"4cd916d5b0b7430d","type":"debug","z":"54efb553244c241f","name":"debug 36","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":840,"y":2380,"wires":[]}]

```

Note: i have also added `Content-Type: application/xml` in the http-request that seems to be needed for the server to know what your are sending.  
Also changed the http-request Return to be parsed as JS object since its JSON

---

<div class="post-metadata">

**Author:** ![Nichlas](https://avatars.discourse-cdn.com/v4/letter/n/57b2e6/32.png) [@Nichlas](https://discourse.nodered.org/u/Nichlas)\
**Post date:** [5 April 2023 16:52 UTC](https://discourse.nodered.org/t/post-request-to-dashboard/77250/3 "2023-04-05T16:52:42Z")

</div>

That works perfect, thanks for the help!

---

<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:** [5 May 2023 16:52 UTC](https://discourse.nodered.org/t/post-request-to-dashboard/77250/4 "2023-05-05T16:52:57Z")

</div>

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