# Libcurl response 415 Unsupported Media Type

**URL:** <https://clarionhub.com/t/libcurl-response-415-unsupported-media-type/8286>\
**Category:** questions\
**Tags:** api, libcurl\
**Created:** [June 12, 2025, 3:25pm UTC](https://clarionhub.com/t/libcurl-response-415-unsupported-media-type/8286 "2025-06-12T15:25:59Z")\
**Posts on this page:** 3\
**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:** [June 12, 2025, 3:25pm UTC](https://clarionhub.com/t/libcurl-response-415-unsupported-media-type/8286/1 "2025-06-12T15:25:59Z")

</div>

Hi all,

I am (probably) stuck on a syntax issue.

Attached is a working postman example. When I submit using the code below I get an http code 415 (Unsupported Media Type) back.

What am I doing wrong?

Thanks in advance.

Henk Ouwejan

```clarion
ShipmentDPD PROCEDURE

res CURLcode
resCode SHORT

  CODE
  ?TEXT:Response{PROP:Text} = ''
  json.Start()
  json.LoadFile('c:\temp\boekuwzending.json') ! message in json format
  json.savestring(st,True)
  ?TEXT:Request{PROP:Text} = st.GetValue()
  curl.init()
  curl.useSSL(CURLUSESSL_ALL)
  curl.setSSLVerifyPeer(False)
  curl.setSSLVerifyHost(False)
  curl.setCustomRequest('POST')
  curl.addHttpHeader('Content-Type: application/json')
  curl.addHttpHeader('Accept: application/json')
  curl.addHttpHeader('Authorization: Bearer '&CLIP(BUZ:token))
  curl.setHttpHeaders()
  res = curl.sendRequest(CLIP(BUZ:url)&'/shipments',st.GetValue(),ResponseBuffer)
  resCode = curl.GetResponseCode()
  IF res = CURLE_OK
    message('Response: '&resCode,'debug')
    st.SetValue(ResponseBuffer)
    ?TEXT:Response{PROP:Text} = st.GetValue()
    IF json.GetValueByName('error') = 'false'
      message('OK','debug')
    ELSE
      MESSAGE('Resultaat: '&resCode,'debug') ! json.GetValueByName('error'))
      ?TEXT:Response{PROP:Text} = ResponseBuffer
    END
  ELSE
   MESSAGE('Geen juiste response: '&res,'Fout',ICON:Hand)
  END
  DISPLAY
  json.Free()

```

## Working Postman file:

curl --location '[https://api.boekuwzending.com/shipments](https://api.boekuwzending.com/shipments)'   
--header 'Content-Type: application/json'   
--header 'Authorization: Bearer xxx'   
--data-raw '{  
"invoiceReference": "81",  
"transportType": "road\_transport",  
"shipTo": {  
"contact": {  
"name": "Cees Vegers",  
"emailAddress": "[xxx@boekuwzending.com](mailto:xxx@boekuwzending.com)",  
"phoneNumber": "0612345678",  
"company": ""  
},  
"address": {  
"number": "265",  
"street": "Bennebroekerweg",  
"numberAddition": "",  
"addressLine1": "",  
"addressLine2": "",  
"postcode": "1435CJ",  
"city": "Nieuw-Vennep",  
"country": "NL",  
"privateAddress": 1,  
"forkliftOrLoadingDockAvailable": "",  
"accessibleWithTrailer": ""  
}  
},  
"dispatch": {  
"instructions": "",  
"reference": "",  
"timeWindow": {  
"begin": null,  
"end": null  
},  
"vatNumber": "",  
"eoriNumber": "",  
"date": "2025-06-04"  
},  
"items": [  
{  
"quantity": 1,  
"type": "package",  
"dimensions": {  
"length": 1,  
"height": 10,  
"width": 10  
},  
"weight": 1,  
"description": "Pakket",  
"value": null,  
"tariffNumber": "",  
"countryOfOrigin": "",  
"customerReference": ""  
}  
],  
"service": "dpd-classic"  
}'

---

<div class="post-metadata">

**Author:** ![PurpleEdge2214](https://clarionhub.com/user_avatar/clarionhub.com/purpleedge2214/32/5109_2.png) [@PurpleEdge2214](https://clarionhub.com/u/PurpleEdge2214)\
**Post date:** [June 13, 2025, 7:01am UTC](https://clarionhub.com/t/libcurl-response-415-unsupported-media-type/8286/2 "2025-06-13T07:01:20Z")

</div>

I haven’t looked up how to do this with Libcurl and I’m not familiar enough with it to spot any obvious code errors, but the first thing I would be checking is that I actually had the JSON code and that I was using the correct method to attach that JSON to the request.

---

<div class="post-metadata">

**Author:** ![John\_Singer](https://clarionhub.com/user_avatar/clarionhub.com/john_singer/32/5717_2.png) [@John\_Singer](https://clarionhub.com/u/John_Singer)\
**Post date:** [June 13, 2025, 2:22pm UTC](https://clarionhub.com/t/libcurl-response-415-unsupported-media-type/8286/3 "2025-06-13T14:22:36Z")

</div>

Have you tried using the --libcurl example.c command line option with your working Postman file? This will create a working C program with all the curl commands. These can usually be translated to libcurl calls.
