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

allow receive single HTTP measures using attribute values in plain, raw and json content-types #667

Merged
merged 22 commits into from
May 31, 2022

Conversation

AlvaroVega
Copy link
Member

@AlvaroVega AlvaroVega commented May 24, 2022

issue #661

  • New endpoint for POST single measures: /iot/json/attrs/:attrValue allowing these content-types: application/json, text/plain, application/octet-stream
  • Doc
  • Test / examples

This PR enables send single measures like:

curl -i -X POST 'http://localhost:7897/iot/json/attrs/myattr1?i=disp4&k=6idn7z9cba3o57tgoascazdwd' -d '33' -H 'content-type: application/json'

curl -i -X POST 'http://localhost:7897/iot/json/attrs/myattr1?i=disp4&k=6idn7z9cba3o57tgoascazdwd' -d 'asdfasdfasd' -H 'content-type: text/plain'

curl -i -X POST 'http://localhost:7897/iot/json/attrs/myattr1?i=disp4&k=6idn7z9cba3o57tgoascazdwd' -d '01010011' -H 'content-type: application/octet-stream'

@AlvaroVega AlvaroVega changed the title [WIP] allow send single measures using attribute values in plain, raw and json content-types [WIP] allow send single HTTP measures using attribute values in plain, raw and json content-types May 24, 2022
@AlvaroVega
Copy link
Member Author

@AlvaroVega
Copy link
Member Author

AlvaroVega commented May 26, 2022

Default attribute type used by MQTT when a single measrue is receive from /json/apikey/<id>/attrs/<attname> is string, which maybe is wrong.
In this case, using HTTP, defaul type will be None

@AlvaroVega AlvaroVega changed the title [WIP] allow send single HTTP measures using attribute values in plain, raw and json content-types allow send single HTTP measures using attribute values in plain, raw and json content-types May 30, 2022
@AlvaroVega AlvaroVega changed the title allow send single HTTP measures using attribute values in plain, raw and json content-types allow receive single HTTP measures using attribute values in plain, raw and json content-types May 30, 2022
@AlvaroVega AlvaroVega requested a review from fgalan May 31, 2022 07:01
@fgalan
Copy link
Member

fgalan commented May 31, 2022

Should a twin PR be done for IOTA-UL?

CHANGES_NEXT_RELEASE Outdated Show resolved Hide resolved
@AlvaroVega
Copy link
Member Author

Should a twin PR be done for IOTA-UL?

This issue does not applies to iota-ul

Co-authored-by: Fermín Galán Márquez <fgalan@users.noreply.github.com>
Comment on lines 1 to 4
- Add: allow receive single HTTP attribute measures posted to `/iot/json/attrs/<attributeName>` with different content-types `application/json`, `text/plain` and `application/octet-stream`
- Upgrade body-parser dep from 1.18.3 to 1.20.0
- Upgrade express dep from ~4.16.4 to 4.18.1
- Fix: do not use json parse strict for incoming http measures, commands and configuration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue #661 should be cited (not sure if in the "Add:" line, in the "Fix:" line or in both)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 6d42384

lib/bindings/HTTPBinding.js Outdated Show resolved Hide resolved
AlvaroVega and others added 2 commits May 31, 2022 10:17
Co-authored-by: Fermín Galán Márquez <fgalan@users.noreply.github.com>
Copy link
Member

@fgalan fgalan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants