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

How to communicate with DeviceHive using curl #544

Open
jalin168 opened this issue Apr 9, 2021 · 1 comment
Open

How to communicate with DeviceHive using curl #544

jalin168 opened this issue Apr 9, 2021 · 1 comment

Comments

@jalin168
Copy link

jalin168 commented Apr 9, 2021

I refer to deployment-with-docker and use docker-compose up -d to successfully execute DeviceHive.
I can log in with dhadmin:dhadmin_#911.

Next, I want to test the ApiInfo API
I use the HTTP tool curl to command:
curl -v -X GET http://localhost/admin/admin/info
The returned result is not as shown by the ApiInfo API, the LOG is as follows:

D:\devicehive-docker-3.5.0\rdbms-image>curl -v -X GET http://localhost/admin/admin/info
Note: Unnecessary use of -X or --request, GET is already inferred.
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET /admin/admin/info HTTP/1.1
> Host: localhost
> User-Agent: curl/7.55.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: nginx/1.14.0
< Date: Fri, 09 Apr 2021 08:17:50 GMT
< Content-Type: text/html
< Content-Length: 694
< Last-Modified: Mon, 04 Jun 2018 10:54:51 GMT
< Connection: keep-alive
< ETag: "5b151a7b-2b6"
< Accept-Ranges: bytes
<
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Devicehive Admin Panel</title><base href="/admin/"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" type="image/x-icon" href="favicon.ico"><link href="styles.d6b41c382247cdab36d9.bundle.css" rel="stylesheet"/></head><body><dh-root></dh-root><script type="text/javascript" src="inline.570ed68e3fb93164bffb.bundle.js"></script><script type="text/javascript" src="polyfills.449eac0baaf097d8bdf8.bundle.js"></script><script type="text/javascript" src="scripts.9891c164e0adeb7e15ef.bundle.js"></script><script type="text/javascript" src="main.b140f0fefb939e44372c.bundle.js"></script></body></html>* Connection #0 to host localhost left intact

D:\devicehive-docker-3.5.0\rdbms-image>

Is my communication format wrong?
May you provide practical examples?
Thank you.

@itrambovetskyi
Copy link
Collaborator

curl -X GET --header "Accept: application/json" --header "X-Forwarded-Proto: http" "http://localhost/api/rest/info"

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

No branches or pull requests

2 participants