Error when inserting through API

Discussion in 'Installation/Configuration' started by PieterW, Mar 5, 2020.

Tags:
  1. PieterW

    PieterW New Member

    Hi!

    I'm looking for why inserting a client through the API does not work in my case?
    The error is Data truncated for column 'limit_cron_type' at row 1 INSERT INTO `client` . With limit_cron_type set to ''.

    Can anyone tell me why this does not work or what I need to change in the config to make this work?

    Kind regards, Pieter
     
    Last edited: Mar 5, 2020
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Create a client in ispconfig gui and set the settings the way you want them to be. Then take look into the client database table to see how these settings look like in the database and adjust yozúr api call accordingly.
     
  3. PieterW

    PieterW New Member

    The default in the database is "url". If I just give nothing in the call, the default value should be inserted, right? Since the value can't be NULL. It doesn't insert "url" when I provide an empty value.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    No, you have to send all fields in the insert api call.
     
    PieterW likes this.
  5. PieterW

    PieterW New Member

    Thanks for the info! Do you have a link to the latest API docs? Or any link to where this is stated in the documentation?
     
  6. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    I believe the info/examples at https://git.ispconfig.org/ispconfig/ispconfig3/tree/stable-3.1/remoting_client/ is the primary source, though there are numerous working examples in these forums you can find by searching. I don't think there is a comprehensive developer reference akin to the user manual.

    In my own use of the api, I found experimenting with required/allowed fields necessary at times, not just referring to the docs, or even referencing the actual api functions (which I think are under https://git.ispconfig.org/ispconfig/ispconfig3/tree/stable-3.1/interface/lib/classes/remote.d ).
     
    PieterW likes this.
  7. PieterW

    PieterW New Member

    Thank you!
     

Share This Page