Skip to Content

Hybris Marketing Landing Page Integration


I'm currently coding the integration for a Hybris Marketing Landing Page so we can add it to our Web server. I'm using .Net and have coded based on the PHP example provided in the documentation. However, when running the service an error occurs after the POST request, in the JavaScript file generated by Hybris for the following line of code:

var m = JSON.parse(h.responseText)

the response data I'm getting back from the oData service is XML - e.g.

<?xml version="1.0" encoding="utf-8"?>
<entry xml:base="https://<env>:443/sap/opu/odata/sap/CUAN_CONTENT_PAGE_RESULT_SRV/" xmlns="" xmlns:m="" xmlns:d="">
    <title type="text">ResultHeaders('')</title>
    <category term="CUAN_CONTENT_PAGE_RESULT_SRV.ResultHeader" scheme=""/>
    <link href="ResultHeaders('')" rel="self" title="ResultHeader"/>
    <link href="ResultHeaders('')/ResultValues" rel="" type="application/atom+xml;type=feed" title="ResultValues"/>
    <link href="ResultHeaders('')/ContactPersonalizationData" rel="" type="application/atom+xml;type=feed" title="ContactPersonalizationData"/>
    <link href="ResultHeaders('')/ContactFacets" rel="" type="application/atom+xml;type=feed" title="ContactFacets"/>
    <link href="ResultHeaders('')/Answers" rel="" type="application/atom+xml;type=feed" title="Answers"/>
    <content type="application/xml">

Should the service be returning XML? If so, why is the JS file generated by Hybris is performing JSON.parse on the response data? Currently unsure why the issue is happening - any pointers would be appreciated.



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jan 03, 2018 at 10:32 PM

    Turns out I wasn't setting the Accept: application/json header in the request

    Add comment
    10|10000 characters needed characters exceeded