Forum Discussion
dMoney
2 years agoActive Member
Need Help Troubleshooting Connected Content Call
I'm trying to do a connected content call to the Trustpilot API so that I can get back an individualised URL for a customer to submit a trustpilot review: https://documentation-apidocumentation.trust...
Max
2 years agoSpecialist
Hey, looks like your body is not a valid JSON format / object. But the API wants one -> application/json. And you're not putting your data into a string. But the documentation says that the values of your keys should be a string. Next it should be "locale" and not "local". And last but not least, you don't handle errors. Try this one:
{% capture postbody %}
{
"name":"{{${first_name}}}",
"referenceId":"{{${user_id}}}",
"locale":"en-US",
"email":"{{${email_address}}}"
}
{% endcapture %}
{% connected_content
https://invitations-api.trustpilot.com/v1/private/business-units/xxxxx/invitation-links
:method POST
:headers {
"Content-Type": "application/json",
"Authorization": "Bearer xxxxx"
}
:body {{postbody}}
:content_type application/json
:save result
%}
{% if result.__http_status_code__ != 200 %}
{% abort_message('Connected Content returned a non-200 status code') %}
{% endif %}
{{result.url}}
Let me know if you have any further questions 🙂 .
Max
Related Content
- 2 years ago
- 8 months ago
- 12 months ago