# From postman to libcurl

**URL:** <https://clarionhub.com/t/from-postman-to-libcurl/8003>\
**Category:** questions\
**Tags:** api, libcurl\
**Created:** [March 14, 2025, 4:23pm UTC](https://clarionhub.com/t/from-postman-to-libcurl/8003 "2025-03-14T16:23:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![henkouwejan](https://clarionhub.com/letter_avatar_proxy/v4/letter/h/7ea924/32.png) [@henkouwejan](https://clarionhub.com/u/henkouwejan)\
**Post date:** [March 14, 2025, 4:23pm UTC](https://clarionhub.com/t/from-postman-to-libcurl/8003/1 "2025-03-14T16:23:12Z")

</div>

Hi all,

I am less familiar with libcurl, but working with json content works quite well. But now I need to request an access token in form-data and I'm struggling with the syntax. If Ipaste the code below into Postman, it will works fine. But I am not able to put this into correct Clarion code. Does anyone have a suggestion or example?

```dos
 curl --location 'https://api.mysite.com/token' \
--header 'Cookie: last_account_activity=1741340252' \
--form 'client_id="MyID"' \
--form 'client_secret="MySecret"' \
--form 'grant_type="client_credentials"

```

```Clarion
    curl.addHttpHeader('Content-Type: application/form-data')
    curl.addHttpHeader('Cookie: last_account_activity=1741340252')
    curl.setHttpHeaders()
    curl.FormAdd('client_id',BUZ:clientId)
    curl.FormAdd('client_secret',BUZ:clientSecret)
    curl.FormAdd('grant_type','client_credentials')
    cfres = curl.FormPost(CLIP(BUZ:url)&'/token')
    IF res = CURLE_OK
        MESSAGE('OK')

```

I'll get a reponse OK but how to get received data. Should be a json like this:

```json
{
    "token_type": "Bearer",
    "expires_in": 3600,
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGQbtSVNdg7bT9PIECGA2maMBNCLz1MqiUNvNiuMQ"
}

```

Regards,

Henk

---

<div class="post-metadata">

**Author:** ![Mike\_Duglas](https://clarionhub.com/user_avatar/clarionhub.com/mike_duglas/32/1061_2.png) [@Mike\_Duglas](https://clarionhub.com/u/Mike_Duglas)\
**Post date:** [March 14, 2025, 5:35pm UTC](https://clarionhub.com/t/from-postman-to-libcurl/8003/2 "2025-03-14T17:35:24Z")

</div>

Look at the FormPost method declaration.

---

<div class="post-metadata">

**Author:** ![henkouwejan](https://clarionhub.com/letter_avatar_proxy/v4/letter/h/7ea924/32.png) [@henkouwejan](https://clarionhub.com/u/henkouwejan)\
**Post date:** [March 15, 2025, 11:00am UTC](https://clarionhub.com/t/from-postman-to-libcurl/8003/3 "2025-03-15T11:00:59Z")

</div>

Hi Mike,

Thanks for your hint. It brings me to the github examples.

Now I use:

`curl.FormPostStr(CLIP(buz:url)&'/token',respString)`

and the response is coming into respString.

Regards,

Henk

---

<div class="post-metadata">

**Author:** ![Nardus\_Swanevelder](https://clarionhub.com/user_avatar/clarionhub.com/nardus_swanevelder/32/1066_2.png) [@Nardus\_Swanevelder](https://clarionhub.com/u/Nardus_Swanevelder)\
**Post date:** [March 15, 2025, 2:59pm UTC](https://clarionhub.com/t/from-postman-to-libcurl/8003/4 "2025-03-15T14:59:06Z")

</div>

Have you tried CapeSoft’s curl to NetTalk conversion?

[https://www.capesoft.com/curlcode](https://www.capesoft.com/curlcode)

---

<div class="post-metadata">

**Author:** ![Bruce](https://clarionhub.com/letter_avatar_proxy/v4/letter/b/ccd318/32.png) [@Bruce](https://clarionhub.com/u/Bruce)\
**Post date:** [March 16, 2025, 3:38am UTC](https://clarionhub.com/t/from-postman-to-libcurl/8003/5 "2025-03-16T03:38:33Z")

</div>

Hes using Libcurl, not NetTalk.

---

<div class="post-metadata">

**Author:** ![Nardus\_Swanevelder](https://clarionhub.com/user_avatar/clarionhub.com/nardus_swanevelder/32/1066_2.png) [@Nardus\_Swanevelder](https://clarionhub.com/u/Nardus_Swanevelder)\
**Post date:** [March 16, 2025, 5:53am UTC](https://clarionhub.com/t/from-postman-to-libcurl/8003/6 "2025-03-16T05:53:20Z")

</div>

I understand that but he had curl code that he wanted to change to Clarion code and I was thinking the Capesoft converter might give him more examples to look at. Sorry it didn’t meet your expectations.

---

<div class="post-metadata">

**Author:** ![Mike\_Duglas](https://clarionhub.com/user_avatar/clarionhub.com/mike_duglas/32/1061_2.png) [@Mike\_Duglas](https://clarionhub.com/u/Mike_Duglas)\
**Post date:** [March 17, 2025, 2:55pm UTC](https://clarionhub.com/t/from-postman-to-libcurl/8003/7 "2025-03-17T14:55:33Z")

</div>

By the way, FormPost is considered an outdated approach, MimePost is recommended.
