Get the History via a Single dynamic requests (API)

Hi there,

Is it possible to get a history list (txt or json) via a single dynamic requests (API) ?

Or if not, maybe get the export CSV by the same way ?

I saw that it's possible to get a log file this way : http://localhost:3344/printer/log/<slug>?a=download&sess=<session key>&l=<log name>

And that works pretty fine...

Thanks in advance,
Regards,
Fred 

Comments

  • Yes, it is possible. The command is just not documented.

    Action is historyList and required parameter are:
    {
    start: 0,
    limit: 50,
    slug: slug
    uuid: '',
    allPrinter: false
    } uuid needs to be there but is not used. Set limit = 0 to get all entries, otherwise you get the newest x extries starting at start.
  • Hello,

    Thank you for your answer.

    I have tried these two syntaxes :
    http://192.168.1.251:3344/historyList/PP3D?apikey=ourAPIKEY&limit=10&uuid=&allPrinter=false
    (slug=PP3D)

    But in both case, I receive this message : Requested file not found.
    Our Repetier Server version is 0.86.2

    Is there something wrong in my syntax ?

    Best regards,
    Fred
  • Yes that does not work. It is a websocket command, not a direct link command. Read
    https://www.repetier-server.com/manuals/programming/API/index.html
    especially how to issue websocket commands directly. All params go into the data parameter which is the json string in url encoded form.
  • Great ! It works. Thank you.
  • edited October 2021
    HI,
    I have a problem retrieving the history via api call
    I followed the directions but I always get: {"list": []} I don't understand where I'm wrong
    I have Repetier Server Pro 1.2.0
    the request I send is:
    192.168.12.169:3344/printer/api/P430?a=historyList&data=%7Bstart%3A0%2Climit%3A0%2Cslug%3AP430%2Cuuid%3A%2CallPrinter%3Atrue%7D&apikey= <MyAPI-KEY>

    Regards,
  • Yes, you have limit = 0 so you want the first 0 entries. Increase limit to the number of hits you want.
  • I tried to bring it to 10 but I have the same result
    if I look from the web interface in the history I have 4 items

    192.168.2.169:3344/printer/api/P430?a=historyList&data=%7Bstart%3A0%2Climit%3A10%2Cslug%3AP430%2CallPrinter%3Atrue%7D&apikey=
  • instead if I send:
    192.168.2.169:3344/printer/api/P430?a=listPrinter&apikey=
    i get this:
    [{"active":true,"job":"none","name":"peek","online":0,"pauseState":0,"paused":false,"slug":"peek"},{"active":true,"job":"none","name":"P430","online":0,"pauseState":0,"paused":false,"slug":"P430"}]
  • If you open debug tools, reload and go to network and select the websocket. If you set filter to historyList and go to function in gui you see how it gets called.

    But when I decode your data part I get
    {start:0,limit:10,slug:P430,allPrinter:true}

    which is no valid json. Valid json would be
    {"start":0,"limit":10,"slug":P430,"allPrinter":true}

    See the double quotes for strings and names!
  • edited September 2022
    I'm trying to use historyList directly but keep getting the return "error":"unknown printer"

    This is the http request I'm using:

    [mylocalhost]:3344/printer/api/prusa_1?a=historyList&data=%7B%0A%20%20%20%20%22start%22%3A1%2C%0A%20%20%20%20%22limit%22%3A100%2C%0A%20%20%20%20%22slug%22%3A%22prusa_1%22%2C%0A%20%20%20%20%22uuid%22%3A%22%22%2C%0A%20%20%20%20%22allPrinter%22%3Atrue%0A%7D&apikey=[myapikey]

    The data JSON for this request is supposed to be:

    {
        "start": 1,
        "limit": 100,
        "slug": "prusa_1",
        "uuid": "",
        "allPrinter": true
    }

    Am I missing something obvious?  Any advice would be greatly appreciated!
  • Comparing with what gui sends start should be 0 and "page":0 for first 50 is missing. Assuming prusa_1 is the correct slug shown also in url that might be what is missing causing the error. If not, let me know and I double check.
  • edited September 2022
    Thanks for getting back to me so quickly.  It turns out the issue was the slug is actually "Prusa_1" rather than "prusa_1", in the first part of the request URL (not the data).  I didn't think to check if it was case sensitive before.  I appreciate the help!
Sign In or Register to comment.