API Documentation

Topics around mechanical design, controller and electronics. Mods & hacks welcome.
Ikoth
Posts: 23
Joined: Mon Oct 31, 2016 7:01 pm

API Documentation

Postby Ikoth » Thu Nov 01, 2018 10:53 am

Hi there

firstly, thanks to Raise3d for implementing an API. This will be of great use for those wanting to monitor their printers from third party applications.

However, the documentation, while appearing comprehensive is not very clear. All the example calls show how a token is needed to retrieve information from the printer, but there is no CLEAR explanation of how to obtain the token. Specifically, the use of the "sign" and "timestamp" parameters is confusing. How do I obtain the token needed to query the API, and do I really need to work out "
the number of milliseconds from (1970-01-01 00:00:00.000) to now" and include that in every API call I make?

Please provide a clear, step-by-step guide to accessing the API and retrieving some data. The documentation for the individual API calls seems to be very thorough, but the lack of clarity around how to execute them is a show stopper for me.

Also, if I'm reading the documentation correctly, the generated token expires after 24 hours? This means that a new token must be generated every day??? If true, that's going to complicate things enormously. Why not just simply allow a username and password (better still, a passhash) to be appended to the API call? The need to generate new tokens every day will make it much harder to get API data into status dashboards.

Cheers,

Ikoth.

Ikoth
Posts: 23
Joined: Mon Oct 31, 2016 7:01 pm

Re: API Documentation

Postby Ikoth » Thu Nov 01, 2018 12:31 pm

Making some progress in that I'm now getting an API error back:

For example, assuming my SSH password is - mysecretpassword (I can successfully SSH to the printer using this password.)

Using an online epoch converter gives me a timestamp of - 1541075165000

Entering - password=mysecretpassword&timestamp=1541075165000 into an online SHA1 generator gives me - c7b00c4914bcdde9f4a52579d935eaa2030163d2

Entering - c7b00c4914bcdde9f4a52579d935eaa2030163d2 into an online MD5 generator gives me - ccdbefb8d51b91999a16b7c6e8cf2a9d

Submitting this API call -

"http://10.0.0.223:10800/v1/login?sign=ccdbefb8d51b91999a16b7c6e8cf2a9d&timestamp=1541075165000"

produces the error - {"error":{"code":10000,"msg":"sign error or password error"},"status":0}

Suggestions please...?

Cheers,

Ikoth.

Online
User avatar
Vicky@Raise3D
Posts: 6917
Joined: Fri Mar 25, 2016 3:54 am

Re: API Documentation

Postby Vicky@Raise3D » Fri Nov 02, 2018 1:25 am

The password is not the same one for SSH. It is the one which you can set under develop.
Setting token expires over 24 hours is out of security concern in case it being leak to anyone else who may be able to control your printer.


Return to “Hardware”

Who is online

Users browsing this forum: No registered users and 2 guests