Creating actvities inside deals

I’m creating a (long) list of deals with the API and that’s fine, but i also need create inside each one a task, and i don’t know how receive back deal_id to keep my automatization.

Can i do that?

Hi @gustavo.vieira

Which endpoint are you using ? If its via POST to /v1/deals, you would receive the id in the response

Let me know if I am missing something

I used a piece of code in python to get exactly what i want.

for i in negocio:   
    params = {
        'term': i,
        'fields': 'title',
        'exact_match': 'true'}
    response = client.deals.search_deals(params=params)
    deal_id.append(response)

> deal_id


for d in deal_id:
    
    count = 0
    for k, v in d.items():
        if isinstance(v, dict):
            for k, vl in v.items():
                # maybe you need more loop iof there are more than one [item {...}]
                if vl and isinstance(vl, list):
                    temp = {"item": {"id": vl[0].get("item").get("id")}}
    id_item.append(temp)
    count = count + 1

id_activitie = [x['item']['id'] for x in id_item]

Variable “negocios” are my list of deals that i want get the id.