# formatting a Post Request

**URL:** <https://forum.knime.com/t/formatting-a-post-request/75477>\
**Category:** KNIME Analytics Platform\
**Created:** [November 21, 2023, 8:57pm UTC](https://forum.knime.com/t/formatting-a-post-request/75477 "2023-11-21T20:57:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeffhollandbiz](https://forum-cdn.knime.com/user_avatar/forum.knime.com/jeffhollandbiz/32/40837_2.png) [@Jeffhollandbiz](https://forum.knime.com/u/Jeffhollandbiz)\
**Post date:** [November 21, 2023, 8:57pm UTC](https://forum.knime.com/t/formatting-a-post-request/75477/1 "2023-11-21T20:57:05Z")

</div>

I am hoping someone can help me. I am trying to obtain an OAuth token via a post request to Wild Apricot. Looking at their documentation it says I need the below. But I can’t figure out how to get it all into the KNIME Post Request node so that it works. Can anyone help with how to set this up? I have my API key and I can encode it into base64 with no issue.

POST /auth/token HTTP/1.1  
Host: [oauth.wildapricot.org](http://oauth.wildapricot.org)  
Authorization: Basic BASE64\_ENCODED(“APIKEY:YOUR\_API\_KEY”)  
Content-type: application/x-www-form-urlencoded

grant\_type=client\_credentials&scope=auto

* * *

Here is an example with a nonvalid API key  
POST /auth/token HTTP/1.1  
Host: [oauth.wildapricot.org](http://oauth.wildapricot.org)  
Authorization: Basic QVBJS0VZOm85c2U4N3Jnb2l5c29lcjk4MDcwOS0=  
Content-type: application/x-www-form-urlencoded

grant\_type=client\_credentials&scope=auto

---

<div class="post-metadata">

**Author:** ![ArjenEX](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/a/97f17d/32.png) [@ArjenEX](https://forum.knime.com/u/ArjenEX)\
**Post date:** [November 21, 2023, 10:22pm UTC](https://forum.knime.com/t/formatting-a-post-request/75477/2 "2023-11-21T22:22:57Z")

</div>

To be honest, I would contact them to help you out. As per usual, their documentation is unreliable. The API via a POST request in KNIME returns a 405 but it’s not even documented what this means to them 🙄

This could be an alternative:

> **[Having trouble authenticating in Postman](https://forums.wildapricot.com/forums/309658-developers/suggestions/46386592-having-trouble-authenticating-in-postman)**
>
> I'm working on authenticating in Postman for an upcoming project and this is what I'm sending:
> 
> POST /auth/token HTTP/1.1
> Host: oauth.wildapricot.org
> Authorization: Basic {{API KEY GOES HERE}}
> Content-Type:...

---

<div class="post-metadata">

**Author:** ![Jeffhollandbiz](https://forum-cdn.knime.com/user_avatar/forum.knime.com/jeffhollandbiz/32/40837_2.png) [@Jeffhollandbiz](https://forum.knime.com/u/Jeffhollandbiz)\
**Post date:** [November 22, 2023, 1:11am UTC](https://forum.knime.com/t/formatting-a-post-request/75477/3 "2023-11-22T01:11:24Z")

</div>

I told it to output the error code and I am getting this: “Response doesn’t have a media type”

Any ideas?

---

<div class="post-metadata">

**Author:** ![AlexanderFillbrunn](https://forum-cdn.knime.com/user_avatar/forum.knime.com/alexanderfillbrunn/32/357_2.png) [@AlexanderFillbrunn](https://forum.knime.com/u/AlexanderFillbrunn)\
**Post date:** [November 22, 2023, 8:44am UTC](https://forum.knime.com/t/formatting-a-post-request/75477/4 "2023-11-22T08:44:00Z")

</div>

Hi,  
This sounds like the server does not send a content-type header and KNIME does not know how to interpret the data it receives. However, in KNIME we could work around this by defaulting to the output of a binary object cell, which you could then treat however you liked (e.g. using [Binary Objects to Strings](https://kni.me/n/GGizdmCp9FrQgEGI)). I have created a ticket for our developers to implement this. The internal number is AP-21564.  
As this will not help you now, you may be able to use this POST Request component I published a while ago: [Custom POST Request – KNIME Community Hub](https://hub.knime.com/-/spaces/-/~GP8qdBBWySbX3JBT/current-state/). Here you can choose a body column containing `grant_type=client_credentials&scope=auto`, and you need another column named `Content-type` with the content `application/x-www-form-urlencoded` and another one named `Authorization` with your base64 encoded API key as content. Then you can select the latter two columns under “Header Columns”.  
Kind regards,  
Alexander

---

<div class="post-metadata">

**Author:** ![Jeffhollandbiz](https://forum-cdn.knime.com/user_avatar/forum.knime.com/jeffhollandbiz/32/40837_2.png) [@Jeffhollandbiz](https://forum.knime.com/u/Jeffhollandbiz)\
**Post date:** [December 18, 2023, 3:23pm UTC](https://forum.knime.com/t/formatting-a-post-request/75477/5 "2023-12-18T15:23:45Z")

</div>

thanks, I am trying to get this to work, but there are no examples for this node. I cant get it to accept any column as the body, it only shows … and has no drop down to select the column. Could you provide any details on how to specify the body text for this node?

---

<div class="post-metadata">

**Author:** ![AlexanderFillbrunn](https://forum-cdn.knime.com/user_avatar/forum.knime.com/alexanderfillbrunn/32/357_2.png) [@AlexanderFillbrunn](https://forum.knime.com/u/AlexanderFillbrunn)\
**Post date:** [December 18, 2023, 3:47pm UTC](https://forum.knime.com/t/formatting-a-post-request/75477/6 "2023-12-18T15:47:16Z")

</div>

Hi,  
Please find an example [here](https://hub.knime.com/-/spaces/-/~sepdYQb6kgbUTVRz/current-state/). I made input and output body a binary column so it is more versatile. That’s why your string column cannot be selected.  
Kind regards,  
Alexander

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [March 17, 2024, 3:47pm UTC](https://forum.knime.com/t/formatting-a-post-request/75477/7 "2024-03-17T15:47:50Z")

</div>

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