Remove lead from target list with API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • egy87
    Junior Member
    • May 2022
    • 2

    Remove lead from target list with API

    Hello everybody,

    I'm trying to delete a leads from a target list with API (python). The function executed is:

    client.request('DELETE', f'Lead/LEAD_ID/targetLists', {'id': TARGET_LIST_ID})


    Unfortunately the function always return false and I'm not able to delete leads from list.

    Any suggestion?
    Thank you
  • yuri
    Member
    • Mar 2014
    • 8455

    #2
    Weird,

    Try debugging. https://github.com/espocrm/espocrm/b...ecord.php#L113

    You can put $GLOBALS['log']->error('some message'); it will be printed to the log.

    According this method, false is returned only in the case neither 'id' nor 'ids' parameters were passed in the payload.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • egy87
      Junior Member
      • May 2022
      • 2

      #3
      I found the issue

      In API Python library of espocrm (espo_api_client.py) in the class EspoAPI. At line 59 there is:

      if method in ['POST', 'PATCH', 'PUT']:

      I changed with:

      if method in ['POST', 'PATCH', 'PUT', 'DELETE']:


      Now everythings work as expected.
      Thank you for point me in right directcion!

      Comment

      Working...