BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
VMoraal
Fluorite | Level 6

Hi Everyone,

 

I am looking for advice on a problematic JSON response from an API.

 

The API response in question contains a "formula" field which contains some kind of interval written as: "x>400 && x<1700".

From what I can see in other tools, including Python, Lua, Notepad++ & Firefox, the JSON is valid and parses correctly. In ESP however, when the JSON comes through, no error shows, but no data comes through either.

When looking at the ESP-Server-Pod's logs I saw that that "formula" field was throwing errors because of unexpected or wrong html syntax... (see log screencap attached)

VMoraal_0-1706868932905.png

 

Does anyone have any idea how I can force ESP to just pass the response to a proper JSON parser and just ignore these HTML errors?
Because the way I see it, these errors aren't relevant for the parsing of the JSON as #1: this field is ignored, and #2: this isn't HTML it's JSON...

 

Thanks in advance for the help and advice 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
VMoraal
Fluorite | Level 6

Dear VMoraal,

I think it is time for you to pack your bag and start your weekend... You clearly can't read.

The problem was due to the lack of declaration of the content-type in the request name. Somehow my brain was stuck somewhere else.

 

Other users beware! If you don't declare the content type, ESP will read the response of your request as HTML.

<request name="api_query" contentType="application/json">

View solution in original post

2 REPLIES 2
VMoraal
Fluorite | Level 6

Additional context to the question above.

The API in question is being queried using the URL Connector with an XML file which defines the following headers as well as the JSON parsing for events generation:

Authorization: "Basic [key]"

Content-Type: "application/json"

VMoraal
Fluorite | Level 6

Dear VMoraal,

I think it is time for you to pack your bag and start your weekend... You clearly can't read.

The problem was due to the lack of declaration of the content-type in the request name. Somehow my brain was stuck somewhere else.

 

Other users beware! If you don't declare the content type, ESP will read the response of your request as HTML.

<request name="api_query" contentType="application/json">

Whether you're already using SAS Event Stream Processing or thinking about it, this is where you can connect with your peers, ask questions and find resources.

 

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 927 views
  • 0 likes
  • 1 in conversation