Home » Eclipse Projects » Eclipse Kapua » POST data to kapua(problem with sending data to kapua over http post request described in swagger)
POST data to kapua [message #1777562] |
Thu, 30 November 2017 11:01  |
Dusan Zivkovic Messages: 3 Registered: November 2017 |
Junior Member |
|
|
Hello,
I have problem to send data to kapua over HTTP post request. So far i successfully used this routes:
- POST /authentication/user Authenticate an user
- GET /{scopeId}/data/metrics Gets the MetricInfo list in the scope
-GET /{scopeId}/data/messages/{datastoreMessageId} Gets an DatastoreMessage
Route i have problem to use:
- POST /{scopeId}/data/messages Stores a new KapuaDataMessage
This is json that should be sent in body:
{
"scopeId": "string",
"position": {
"timestamp": "2017-11-30T10:51:02.090Z",
"precision": 0,
"status": 0,
"longitude": 0,
"latitude": 0,
"altitude": 0,
"heading": 0,
"speed": 0,
"satellites": 0
},
"payload": {
"body": [
"string"
],
"metrics": {}
},
"id": "string",
"clientId": "string",
"deviceId": "string",
"receivedOn": "2017-11-30T10:51:02.090Z",
"sentOn": "2017-11-30T10:51:02.090Z",
"capturedOn": "2017-11-30T10:51:02.090Z",
"channel": {
"semanticParts": [
"string"
]
}
}
For some values I'm not sure what goes there
- id, body
Problem is that every attempt respond with this
type":"throwableInfo",
"httpErrorCode":500,
"kapuaErrorCode":
"SEVERE_INTERNAL_ERROR",
"stackTrace":"javax.ws.rs.NotSupportedException: HTTP 415 Unsupported Media Type\n\ta and 50more lines of text
|
|
|
Re: POST data to kapua [message #1777981 is a reply to message #1777562] |
Thu, 07 December 2017 09:43   |
Milan Ggg Messages: 28 Registered: March 2017 |
Junior Member |
|
|
Kapua was built as cloud platform to work wit Eclipse Kura framework( ofc and to work with other languages also, but Kura and Kapua works best :) ). Kura has KuraPayload class for sending data to cloud, and Kapua expects KuraPayload message structure. You can find KuraPayload class on this link :
https://github.com/eclipse/kura/blob/develop/kura/org.eclipse.kura.api/src/main/java/org/eclipse/kura/message/KuraPayload.java
And as for your example, I can provide you with document that contains dummy data JSON response from kapua, so you can see how it looks. I am not sure, also, that all API methods works. Most of POST methods for sending data to Kapua didn't work on previous versions. :)
Also, take a look on : https://github.com/ctron/kapua-gateway-client
* In JSON that I attached, I put ***** characters instead of some personal data.
Regards (Pozdrav :) ),
Milan
|
|
|
Re: POST data to kapua [message #1777982 is a reply to message #1777562] |
Thu, 07 December 2017 09:43   |
Milan Ggg Messages: 28 Registered: March 2017 |
Junior Member |
|
|
Kapua was built as cloud platform to work wit Eclipse Kura framework( ofc and to work with other languages also, but Kura and Kapua works best :) ). Kura has KuraPayload class for sending data to cloud, and Kapua expects KuraPayload message structure. You can find KuraPayload class on this link :
https://github.com/eclipse/kura/blob/develop/kura/org.eclipse.kura.api/src/main/java/org/eclipse/kura/message/KuraPayload.java
And as for your example, I can provide you with document that contains dummy data JSON response from kapua, so you can see how it looks. I am not sure, also, that all API methods works. Most of POST methods for sending data to Kapua didn't work on previous versions. :)
Also, take a look on : https://github.com/ctron/kapua-gateway-client
* In JSON that I attached, I put ***** characters instead of some personal data.
Regards (Pozdrav :) ),
Milan
|
|
| | |
Re: POST data to kapua [message #1778174 is a reply to message #1778166] |
Mon, 11 December 2017 13:28   |
Dusan Zivkovic Messages: 3 Registered: November 2017 |
Junior Member |
|
|
Hmm, I'm a bit confused, I can read data sent from kapua using API on this routes:
- GET /{scopeId}/data/metrics Gets the MetricInfo list in the scope
-GET /{scopeId}/data/messages/{datastoreMessageId} Gets an DatastoreMessage
And also there is route for posting data over API explained in swagger
POST /{scopeId}/data/messages Stores a new KapuaDataMessage
If you agree i would like to continu this conversation in private chat, but I haven't found chat between forum members.
[Updated on: Fri, 15 December 2017 15:50] Report message to a moderator
|
|
| |
Goto Forum:
Current Time: Sun May 28 04:44:24 GMT 2023
Powered by FUDForum. Page generated in 0.01640 seconds
|