interact with API using python

Hi Everyone there,

Could anybody help with below: I want to get, post and put from sugarCRM cloud API using python.

I can make get Contacts work, but the filter just doesn't work...

hdr = {
        "Cache-Control""no-cache",
        "Content-Type""application/json",

        "OAuth-Token": session["access_token"],

    }
pload = {"max_num"1000}
resp = requests.get(urljoin(SITENAME, 'Contacts'), json=pload, headers=hdr)
Above code will give me all records for Contacts,
but I tried this pload 
pload ={"max_num":1000, "filter": [{"name":{"$starts":"Olivia"}}]}
, and the filter doesn't work as I expected.
Parents
  • I would recommend to use first_name or last name

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    {
    "filter": [
    {
    "first_name": {
    "$starts": "Charlotte"
    }
    }
    ],
    "max_num": 10,
    "fields": [
    "name",
    "email"
    ]
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Rodrigo Manara

    Sr. Developer

Reply
  • I would recommend to use first_name or last name

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    {
    "filter": [
    {
    "first_name": {
    "$starts": "Charlotte"
    }
    }
    ],
    "max_num": 10,
    "fields": [
    "name",
    "email"
    ]
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Rodrigo Manara

    Sr. Developer

Children