Giter Site home page Giter Site logo

Comments (7)

imbeacon avatar imbeacon commented on June 12, 2024

Hi @IhorYednak,

Thank you for your interest in Thingsboard IoT Gateway, in order to use your config you can try to send the following request:

endpoint - http://92.111.176.157:5000/my_devices
method - POST
data:

{
    "sensorName": "Ihor's Test",
    "sensorType": "default",
    "sensorModel": "Value1",
    "certificateNumber": "Value2"
}

Also you can modify the configuration like the following to process your request, but you still need to choose some endpoint to send, for example - "/my_endpoint" and send request to http://92.111.176.157:5000/my_endpoint , mapping configuration for this case will be the following:

...
    {
      "endpoint": "/my_endpoint",
      "HTTPMethods": [
        "POST"
      ],
      "security": {
        "type": "anonymous"
      },
      "converter": {
        "type": "json",
        "deviceNameExpression": "${name}",
        "deviceTypeExpression": "default",
        "attributes": [
          {
            "type": "string",
            "key": "firstParameter",
            "value": "${parameterOne}"
          }
        ],
        "timeseries": [
          {
            "type": "string",
            "key": "secondParameter",
            "value": "${parameterTwo}"
          }
        ]
      }
    },
...

To get more information about REST and other connector you can use our official documentation.

from thingsboard-gateway.

IhorYednak avatar IhorYednak commented on June 12, 2024

Thank you for your response @imbeacon this is very useful, I corrected my config file, so now it looks like this:

`"host": "127.0.0.1",
  "port": "5000",
  "SSL": false,
  "mapping": [
    {
      "endpoint": "/my_endpoint",
      "HTTPMethods": [
        "POST"
      ],
      "security": {
        "type": "anonymous"
      },
      "converter": {
        "type": "json",
        "deviceNameExpression": "${name}",
        "deviceTypeExpression": "default",
        "attributes": [
          {
            "type": "string",
            "key": "firstParameter",
            "value": "${parameterOne}"
          }
        ],
        "timeseries": [
          {
            "type": "string",
            "key": "secondParameter",
            "value": "${parameterTwo}"
          }
        ]
      }
    },`

But still I got error in Postman and can't process the request
Screenshot_109

Maybe there's something to do with the URL ip address?

from thingsboard-gateway.

imbeacon avatar imbeacon commented on June 12, 2024

Could you check is port opened on your machine and expects connection?

sudo netstat -tlpn | grep 5000

from thingsboard-gateway.

IhorYednak avatar IhorYednak commented on June 12, 2024

@imbeacon
This is what I got
Screenshot_110

from thingsboard-gateway.

IhorYednak avatar IhorYednak commented on June 12, 2024

Screenshot_111
It should be good I think

from thingsboard-gateway.

imbeacon avatar imbeacon commented on June 12, 2024

Ok, it looks like the request cannot arrive to the server, please try to run the following command from the server:

curl -X POST -H "Content-Type: application/json" -d '{
    "sensorName": "Ihor'\''s Test",
    "sensorType": "default",
    "sensorModel": "Value1",
    "certificateNumber": "Value2"
}' http://127.0.0.1:5000/my_devices

and from external machine:

curl -X POST -H "Content-Type: application/json" -d '{
    "sensorName": "Ihor'\''s Test",
    "sensorType": "default",
    "sensorModel": "Value1",
    "certificateNumber": "Value2"
}' http://92.111.176.157:5000/my_devices

If first arrives - the issue may be in firewall or network, for example with port forwarding.

from thingsboard-gateway.

IhorYednak avatar IhorYednak commented on June 12, 2024

Thank you @imbeacon, the issue is solved, I was able to get the data over it by typing the address of the VM itlsef in the rest.json file instead of 127.0.0.1 and after that post data from external machine.
so 5 IOT starts of 5 😄

from thingsboard-gateway.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.