Internal Server Error while a creating a thirdparty using dolibarr API

Hey there,

In postman I tried sending a post request to my dolibarr API URL, alongside with the auth API in params of postman, DOLAPIKEY and value of my API_key
in the body I gave the json structure for creating a third-party i.e. {“name”:[“Example party”], “address”:[“Example address”]
}

Upon sending it is returning me internal server error 500 error message and nothing is in return body.

I also tried using the dolibarr module in python with which the entry is being created of a third-party when send the request, but I don’t know how it is duplicating those entries, Like if I run this code

def create_third_party():
    # Connection to Dolibarr
    dolibarr_inst = Dolibarr(api_url, api_key)

    # Create Third-Party
    params = {
        'name': "Tyrian Lannister Technologies Pvt Ltd.",
        # Add more parameters as needed
    }

    ret_val = dolibarr_inst.call_create_api('thirdparties', params)
    print(ret_val)

and it is creating 2,4 or 6 entries upon running this function of the same name.
Kindly help me resolve this.

Thankyou in advance!

Best,
Vivek

@viveksp3000 when I started using the API i used the API explorer from which there is a link under tools, but you can also just add this to the end of your base dolibarr location.

/api/index.php/explorer/

I then pasted json into the text field and got it working.

Oh Python. Are you using the dolibarrpy python library?

Regarding Python and Dolibarr. Remember that while Python Dicts looks like json, it is not json, and Dolibarr API expects json (or xml).

If you look at your webservers error log, does it write more about why the server gave error 500?

Dolibarr also has it’s own log file, you can usually find it in the documents folder and it is called dolibarr.log - does that contain any more hints as to why you get this error?

@viveksp3000 do you know about this python debugging module? I use it for reporting errors.