Jump to content

Problem with REST API - UM3


inba

Recommended Posts

Posted · Problem with REST API - UM3

Hi,

 

I got a problem with the API. I registered my application, got my id+key and verified it with the the proper API commands (Timestamps differ!).

 

verify.thumb.png.e8d32952f6631d1257ef200a82e7877e.png

 

After that I wanted to change the LED Color like in the "Inside the Ultimaker 3 - Day 3 - Remote access (part 2)". So I tried

{"brightness": 120.0, "saturation": 100.0, "hue": 100.0}

  even if the "Example Value" said "value" instead of brightness. (Postman API call returned (/printer/led) returned "brightness")

 

led.thumb.png.4ff471af8a4b344cfe8db4cb7e773354.png

 

The problem was that the color didn't change. Reboot. Again nothing. I logged up the log after the reboot  and found this in the log:
 

Jun 08 06:51:30 ultimakersystem-ccbdd3004c87 systemd[1]: Time has been changed
Jan 01 00:00:59 ultimakersystem-ccbdd3004c87 connmand[254]: ntp: time slew +1528440630.651671 s
Jan 01 00:00:53 ultimakersystem-ccbdd3004c87 flipflop_wsgi.py[413]: 00:00:53 - WAR - app.libs.printer_api:189 - Failed to set the LED color for printer at http://192.168.0.14/api/v1
...
Jan 01 00:00:43 ultimakersystem-ccbdd3004c87 flipflop_wsgi.py[413]: 00:00:43 - WAR - app.libs.printer_api:189 - Failed to set the LED color for printer at http://192.168.0.14/api/v1

 

Why is the IP different? Or is this just coincidence?  The IP changed indeed from 14 to 31, mhhhh

 

Anyway I tried another command, which was also mentioned in the forum post => Changing the name. The example name was "MyUltimaker3", I tried "Ultimaker3" instead.

 

systemname.thumb.png.7c964893aaf27e3c0774d2eaa7d795be.png

 

Does anyone got an idea why this is a bad request?

 

Another thing is the old firmware. The log says:
 

 Jan 01 00:00:29 ultimakersystem-ccbdd3004c87 python3[226]: 1970-01-01 00:00:29,605 INFO systemUpdate Comparing firmware 'stable' old version '4.2.5.20180102' with new version '4.3.2.20180308' with result: False 

 

Are these just bugs? (Updating is not that easy.I have to ask for permission, since I'm not alone exploring the device )

 

P.S: I'm using Firefox 60.0.2 & Postman 6.1.3

 

  • Link to post
    Share on other sites

    Posted · Problem with REST API - UM3

    With regards to the LED color, I don't think this is supported on the UM3. These LEDs can only produce white. 

     

    The name change : you need to write correct JSON in the request. Something like { "name" :"Ultimaker3" }

     

    (sorry for my short response I 'm on my mobile. Let me know if you want me to elaborate) 

  • Link to post
    Share on other sites

    Posted · Problem with REST API - UM3

    Hey, thanks for your answers, but I don't agree, but I like you to elaborate ? But please have a look at "Inside the Ultimaker 3 - Day 3 - Remote access (part 2)". There are two "PUT" examples: LED & Systemname.

     

    I have seen the case glowing red and green, so it is possible. I can't reproduce it, but it tried some weird combinations of /printer/led and /printer/led/blink with postman.

     

    ledglowing.thumb.jpg.b960c1af258f1bd763ab268ad0d57c38.jpg

     

    Regarding the name: How do I know the right JSON String (I doubt there is).
    In the API Documentation on the printer there are some other examples with JSON and PUT (e.g. /system/display_message). There it is clearly stated, that the input hast to be JSON and how it looks like (Example Value on the left).

     

    systemdisplaymessage.thumb.png.cbb3833491662cd01db30ce7de41db8d.png

     

    Even in the /system/name/ example from the forum post, there is no JSON only the new name (MyUltimaker3)

     

    remoteaccesssystemname.thumb.png.b13368cf73b7e8ef2244f7fa2b2e3b8c.png

     

    Thank you anyway ?

  • Link to post
    Share on other sites

    Posted · Problem with REST API - UM3

    I've never seen any other color, except for the harsh white, but you may be right. I haven't tried it.

     

    How to know what JSON to send? I don't think there is a good and reliable way, except to try it out. I thought you always needed to send JSON and in case of doubt, just use the parameter name that's mentioned in the docs. So it's weird to see an example that does it differently. Maybe this used to be different and they haven't updated the documentation?

  • Link to post
    Share on other sites

    Posted · Problem with REST API - UM3

    @inba If you want to change the color, it's fairly easy to do with gcode. If you've enabled developer mode, you can ssh into the printer using

    ultimaker@192.168.1.x

     and then

    sendgcode M142 r[0-255] g[0-255] b[0-255] w[0-255]

     

    Last I tried, the REST API for changing colors didn't work for me either. Did you authenticate using  

    /auth/verify

     ?

     

    Also, to change the name, it wants a string. so put "MyUltimaker3" in quotes and it should work just fine (after you authenticate your id+key of course).

  • Link to post
    Share on other sites

    Posted · Problem with REST API - UM3

    @pbackx: The screens from my inital post are directly taken from the online documentation, which is located on the printer. On each command there is a "Try out" button, where you can test the command. Both commands are not working, although I got authenticated. I'm pretty sure the LED & name should be easily set, since it's well documented (post) and it worked once (green LEDs)

     

    There is an old version of the api documentation online, just to see how it looks like => Swagger UI

     

    @starbuck: Thanks for the help. Anyway SSH is no option for me at this time ?. Yes I did authenticate (first post, first bluish image). But why are the LED's not working? Is it a bug or a wrong api call? I'll try to change the name with quotation marks the next time.

     

    Some background info: I'm working on a project to control the printer. After some time I finally got the digest authentication working, which I successfully tested with /auth/verify. But I wanted to do a "real" simple test like setting a value. So I tried these two PUT-Commands (LED+Name), described in the "Inside the Ultimaker 3".

  • Link to post
    Share on other sites

    Posted · Problem with REST API - UM3

    Another interesting thing: GET /printer/status => "maintenance".

     

    In the "Inside the Ultimaker 3 - Day 2 - Remote access (part 1)" it says "maintenance: Someone is actively doing things with the printer, for example changing materials or PrintCores."

    I'm only accessing the printer through the WebGUI, why is the status "maintenance"? Could this be the problem?

  • Link to post
    Share on other sites

    Posted · Problem with REST API - UM3

    I solved the problems. As @starbuck said, for renaming I had to quote the name.

  • Link to post
    Share on other sites

    Posted · Problem with REST API - UM3
    On 6/12/2018 at 2:31 PM, inba said:

    I'm only accessing the printer through the WebGUI, why is the status "maintenance"? Could this be the problem?

    That's a good question. I only see it go to "Maintenance" when we're changing filament or leveling the bed or things like that. Usually it says "Idle" or "Printing"

  • Link to post
    Share on other sites

    Posted · Problem with REST API - UM3
    On 6/13/2018 at 8:05 PM, inba said:

    I solved the problems. As @starbuck said, for renaming I had to quote the name.

    This is because you need to provide it with valid JSON. "newname" <- valid string, newname <- not a valid string.

    "maintenance" is a state it goes into when you're changing material / print cores.

    The RGB of the leds can be changed, but people didn't like how it looked (It was seen as damaging to the brand), so we don't use them. Personally I like them, but i understand that there are other factors at play.

  • Link to post
    Share on other sites

    Posted · Problem with REST API - UM3

    Nallath, how can the LED color be changed through the gcode?

    (These blue/white lights are brutal on the eyes)

    I have tried entering:

     

    "M142 r255g140b000w000"

     

    Inside a print file and on its own, but nothing that I've tried has worked.

    Can you guys please add LED color control from the system menu?

  • Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    • Our picks

      • UltiMaker Cura 5.7 stable released
        Cura 5.7 is here and it brings a handy new workflow improvement when using Thingiverse and Cura together, as well as additional capabilities for Method series printers, and a powerful way of sharing print settings using new printer-agnostic project files! Read on to find out about all of these improvements and more. 
         
          • Like
        • 18 replies
      • S-Line Firmware 8.3.0 was released Nov. 20th on the "Latest" firmware branch.
        (Sorry, was out of office when this released)

        This update is for...
        All UltiMaker S series  
        New features
         
        Temperature status. During print preparation, the temperatures of the print cores and build plate will be shown on the display. This gives a better indication of the progress and remaining wait time. Save log files in paused state. It is now possible to save the printer's log files to USB if the currently active print job is paused. Previously, the Dump logs to USB option was only enabled if the printer was in idle state. Confirm print removal via Digital Factory. If the printer is connected to the Digital Factory, it is now possible to confirm the removal of a previous print job via the Digital Factory interface. This is useful in situations where the build plate is clear, but the operator forgot to select Confirm removal on the printer’s display. Visit this page for more information about this feature.
          • Like
        • 0 replies
    ×
    ×
    • Create New...