Discussions

cURL request - 400 Request couldn't be deserialized

brettg
brettg Posts: 12 Blue Ribbon
edited Apr 6, 2020 7:41PM in Developer Tools

I'm trying to use a cURL command to post to a form endpoint, but keep getting a "400 Request couldn't be deserialized" error. Please let me know if you see anything that's amiss with my test script below:

curl --user "APITest\API.User" --header "Content-Type: application/json" --request POST --data '{"emailAddress":"[email protected]"}' https://secure.p04.eloqua.com/API/REST/2.0/data/form/18

== Info: upload completely sent off: 856 out of 856 bytes

<= Recv SSL data, 5 bytes (0x5)

0000: .....

<= Recv header, 31 bytes (0x1f)

0000: HTTP/1.1 403 Permission Error

Post edited by Unknown User on
Tagged:

Answers

  • Lou Patrick
    Lou Patrick Posts: 194 Bronze Trophy
    edited Mar 17, 2020 11:54AM

    For the 403 error, see the Authentication section of the Sending API requests using cURL tutorial for more details on how to authenticate.

    For the 400 error, take a look at the cURL request formatting page for syntax guidelines for the three most commonly used command line tools.

  • brettg
    brettg Posts: 12 Blue Ribbon
    edited Mar 17, 2020 1:03PM

    Thanks for the reply. I know that cURL request formatting page well, but still can't figure out why I'm getting errors when I test in Postman. One thing I'm doing that's different from the example is attempting to post to an Eloqua form, rather than directly to a contact.

  • Lou Patrick
    Lou Patrick Posts: 194 Bronze Trophy
    edited Apr 6, 2020 7:41PM

    Here is the example of how to form the request to submit form data via API from our endpoint docs:

    Content-Type: application/json {<br/>  "<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string" style="color: #880000;">"FormData"</span></span>,<br/>  "<span class="hljs-attribute">fieldValues</span>": <span class="hljs-value">[<br/>  {<br/>      "<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string" style="color: #880000;">"FieldValue"</span></span>,<br/>  <span style="font-family: 'Courier New', Courier, monospace; background-color: #f6f6f6;">    </span>"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-string" style="color: #880000;">"1"</span></span>,<br/>  <span style="font-family: 'Courier New', Courier, monospace; background-color: #f6f6f6;">    </span>"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string" style="color: #880000;">"firstName"</span></span>,<br/>  <span style="font-family: 'Courier New', Courier, monospace; background-color: #f6f6f6;">    </span>"<span class="hljs-attribute">value</span>": <span class="hljs-value"><span class="hljs-string" style="color: #880000;">"John"</span><br/>  </span>},<br/>  {<br/>  <span style="font-family: 'Courier New', Courier, monospace; background-color: #f6f6f6;">    </span>"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string" style="color: #880000;">"FieldValue"</span></span>,<br/>  <span style="font-family: 'Courier New', Courier, monospace; background-color: #f6f6f6;">    </span>"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-string" style="color: #880000;">"2"</span></span>,<br/> <span style="font-family: 'Courier New', Courier, monospace; background-color: #f6f6f6;">    </span> "<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string" style="color: #880000;">"lastName"</span></span>,<br/>  <span style="font-family: 'Courier New', Courier, monospace; background-color: #f6f6f6;">    </span>"<span class="hljs-attribute">value</span>": <span class="hljs-value"><span class="hljs-string" style="color: #880000;">"www.oracle.com"</span><br/>  </span>},<br/>  {<br/>  <span style="font-family: 'Courier New', Courier, monospace; background-color: #f6f6f6;">    </span>"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string" style="color: #880000;">"FieldValue"</span></span>,<br/>  <span style="font-family: 'Courier New', Courier, monospace; background-color: #f6f6f6;">    </span>"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-string" style="color: #880000;">"3"</span></span>,<br/>  <span style="font-family: 'Courier New', Courier, monospace; background-color: #f6f6f6;">    </span>"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string" style="color: #880000;">"emailAddress"</span></span>,<br/>  <span style="font-family: 'Courier New', Courier, monospace; background-color: #f6f6f6;">    </span>"<span class="hljs-attribute">value</span>": <span class="hljs-value"><span class="hljs-string" style="color: #880000;">"<div>"</span><br/>  </span>},<br/>  {<br/>  <span style="font-family: 'Courier New', Courier, monospace; background-color: #f6f6f6;">    </span>"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string" style="color: #880000;">"FieldValue"</span></span>,<br/>  <span style="font-family: 'Courier New', Courier, monospace; background-color: #f6f6f6;">    </span>"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-string" style="color: #880000;">"4"</span></span>,<br/>  <span style="font-family: 'Courier New', Courier, monospace; background-color: #f6f6f6;">    </span>"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string" style="color: #880000;">"optInDate"</span></span>,<br/>  <span style="font-family: 'Courier New', Courier, monospace; background-color: #f6f6f6;">    </span>"<span class="hljs-attribute">value</span>": <span class="hljs-value"><span class="hljs-string" style="color: #880000;">"abc"</span><br/>   </span>}<br/>  ]<br/></span>}POST /api/REST/2.0/data/form/21<br/>