Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom notifications: simplifying sending JSON requests #2560

Closed
fgalan opened this issue Oct 3, 2016 · 4 comments
Closed

Custom notifications: simplifying sending JSON requests #2560

fgalan opened this issue Oct 3, 2016 · 4 comments
Labels
APIv2.1 To be included in a potential NGSI v2.1 API version backlog
Milestone

Comments

@fgalan
Copy link
Member

fgalan commented Oct 3, 2016

Currently is complex to use JSON in custom notifications payload (i.e. payload field in httpCustom) as this field is string-based, so JSON has to be encoded. E.g. (for a current .test):

"payload": "{ %22A1%22: %22${A1}%22, %22A2%22: %22${A2}%22, %22A3%22: %22${A3}%22, %22step%22: %2203%22 }",

Thus, we could adopt a "dual-field" approach as the one in Perseo CEP in the HTTP action, which uses template for string-based coding and json for JSON based encoding.

Only one of boths (payload or the new field json) must be used at a time (error returned in other case).

@fgalan fgalan added this to the NGSIv2SpecPending milestone Oct 3, 2016
@fgalan fgalan added APIv2.1 To be included in a potential NGSI v2.1 API version and removed APIv2 labels Jul 12, 2018
@fgalan
Copy link
Member Author

fgalan commented Jul 12, 2018

Out of the scope of NGSIv2, althouth it is a good idea that could (potentially) be included in a later version of the API (v2.1) in a backward compatible way.

CC: @jmcanterafonseca

@danielvillalbamota
Copy link
Collaborator

danielvillalbamota commented Jun 22, 2022

This should consider the possibility of null values which should not include double quotes. As @fgalan says following the approach of casting in Perseo:

When using NGSI-v2 in the update actions, the value field perform [string substitution](https://github.com/telefonicaid/perseo-fe/blob/master/docs/API/plain_rules.md#string-substitution-syntax). If value is a String, Perseo will try cast value to number, boolean or null (without paying attention to the attribute type). If the casting fails then String is used. Boolean and None types.

@fgalan fgalan added this to the 3.8.0 milestone Jun 22, 2022
@fgalan
Copy link
Member Author

fgalan commented Jul 7, 2022

PR #4157

@fgalan
Copy link
Member Author

fgalan commented Dec 2, 2022

PR #4239 adds more tests and documentation fixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APIv2.1 To be included in a potential NGSI v2.1 API version backlog
Projects
None yet
Development

No branches or pull requests

2 participants