1

Sitecore 9.3

I have an API endpoint and is being used to identify the contact. When it is being called through Sitecore application, it is working absolutely fine but it's failing with below exception while calling with Postman client.

   at Sitecore.Framework.Conditions.EnsuresValidator`1.ThrowExceptionCore(String condition, String additionalMessage, ConstraintViolationType type)
   at Sitecore.Framework.Conditions.Throw.ValueShouldNotBeNull[T](ConditionValidator`1 validator, String conditionDescription)
   at Sitecore.Framework.Conditions.ValidatorExtensions.IsNotNull[T](ConditionValidator`1 validator, String conditionDescription)
   at Sitecore.Analytics.Tracking.StandardSession.IdentifyAs(String source, String knownIdentifier)

Any pointer?

5
  • Are you identifying using an API call?
    – Chris Auer
    Jun 13 '20 at 21:11
  • Yes. That api call have necessary information in its payload. Jun 14 '20 at 1:59
  • I believe what is happening is that the api call you are making doesn’t include the browser cookies. If you are using Fetch use “include security”.
    – Chris Auer
    Jun 14 '20 at 2:03
  • I didnt get you. Can you please give some more details? Thanks Jun 14 '20 at 6:28
  • When you make an API call and you want Sitecore to do analytics stuff, you need to make the API call include all the cookies and such so Sitecore knows who you are. See here in the section "Sending a request with credentials included", developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
    – Chris Auer
    Jun 14 '20 at 19:48
6

We faced the same issue and raised Sitecore support ticket for the same and we get to know that if you try to hit from Postman, need to remove user-agent from postman headers like below -

https://www.screencast.com/t/K0BiMxHv

This was only happening on Sitecore 9.3, in Sitecore 9.0.2 it was working fine for us.

Also, I wrote a blog about this you can check here as well.

0

What you probably after for Postman is your cookie data. You need to grab your cookie data from an active Sitecore request and paste it into Postman. In the screenshot, the bottom frame is from by browser developer tools looking at the network call I am making to Sitecore.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.