KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

%ODBCField2% in HTTP post request inserts \

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting
View previous topic :: View next topic  
Author Message
totte



Joined: 30 May 2007
Posts: 48

PostPosted: Wed Oct 06, 2021 1:57 am    Post subject: %ODBCField2% in HTTP post request inserts \ Reply with quote

Hi

I have an ODBC test returning 2 varchars, I use the variable %ODBCField2% in an http POST alert profile

The reply value in hostmonitor is {"user":"kalle"}. When using this in the alertprofile to post to the api {\"user\":\"kalle\"} is sent.


//t
Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12505
Location: USA

PostPosted: Wed Oct 06, 2021 11:20 am    Post subject: Reply with quote

I assume you set "content-type: application/json" line in HTTP header?
Then HostMonitor translates variable value according to JSON encoding rules. If your database reruns JSON compatible strings, I would suggest to remove such HTTP header.

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
totte



Joined: 30 May 2007
Posts: 48

PostPosted: Thu Oct 07, 2021 3:19 am    Post subject: Reply with quote

Hi,

But then i get html tags like %7B%22user%22%3A%22kalle%20johansson%22%7D


/t
Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12505
Location: USA

PostPosted: Thu Oct 07, 2021 7:06 am    Post subject: Reply with quote

We can add switch, some HTTP header like "hmvars: text", as "do not encode values" indicator.
Please contact support (by e-mail) in order to receive update.

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
totte



Joined: 30 May 2007
Posts: 48

PostPosted: Tue Nov 23, 2021 3:46 am    Post subject: great thanks but.... Reply with quote

Since i´m fråm sweden we have special characters åäö

when posting these characters we get an error

This is sent
Depending on what variable is used å is either Ã¥ (%folder%) and ? in %fvar_variables%

This make my reciever return 400 Bad request...


This is what is sent
{
"message": "Sk?netrafiken/%fvar_servername%/Skånetrafiken/Ping: fel",
"description": "",
"alias": "56156",
"priority": "P1",
"details": {
"Application": "Skånetrafiken",
"Server": "%fvar_servername%",
"Customer": "Sk?netrafiken",
"Reply": "",
"Status": "Unknown host",
"Recurrences": "4",
"RelatedUrl": "",
"CreateErrand": "https://pts.hogia.se/h2h/?HLTemplate=Incident&TID=56156#page1"
},
"tags": [
"Sk?netrafiken",
"Skånetrafiken",
"%fvar_servername%"
]
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index