How to use $in in request

I have to pull /Accounts against specific IDs and trying different methods but not working.

e.g 

rest/v11_8/Accounts?filter[0][id][$in]=[ae6b1eba-eff3-11eb-b5b6-068d8b4b7195]

Parents
  • I would recommend to use the POST filter api, especially if you are passing a number of filters/conditions (like a $in calls for).

    Reason being that urls have a much shorter accepted limit than post payloads.

    Example:

    POST /rest/v10/Leads/filter

    {
        "fields": "id,date_modified,first_name,last_name",
        "filter": [
            {
                "$and": [
                    {
                        "date_modified": {
                            "$gte": "2021-10-17T23:12:15+00:00"
                        }
                    },
                    {
                        "date_modified": {
                            "$lt": "2021-10-23T01:04:43+00:00"
                        }
                    },
                    {
                        "id": {
                            "$in": [
                                "0719c890-2fa0-11ec-8dd2-0221da82edeb",
                                "0711ba6a-2fa0-11ec-8b02-0221da82edeb",
                                "07091018-2fa0-11ec-ac61-0221da82edeb",
                                "06ffe3a8-2fa0-11ec-a2f1-0221da82edeb",
                                "06f6e65e-2fa0-11ec-8c2e-0221da82edeb",
                                "06ee9922-2fa0-11ec-a3bc-0221da82edeb",
                                "06e6ad48-2fa0-11ec-bda2-0221da82edeb"
                            ]
                        }
                    }
                ]
            }
        ],
        "max_num": 10,
        "offset": 0,
        "order_by": "date_modified:DESC,id:DESC"
    }

    Hope it helps!

    --

    Enrico Simonetti

    Sugar veteran (from 2007)

    www.naonis.tech


    Feel free to reach out for consulting regarding:

    • API Integration and Automation Services
    • Sugar Architecture
    • Sugar Performance Optimisation
    • Sugar Consulting, Best Practices and Technical Training
    • AWS and Sugar Technical Help
    • CTO-as-a-service
    • Solutions-as-a-service
    • and more!

    All active SugarCRM certifications

    Actively working remotely with customers based in APAC and in the United States

Reply
  • I would recommend to use the POST filter api, especially if you are passing a number of filters/conditions (like a $in calls for).

    Reason being that urls have a much shorter accepted limit than post payloads.

    Example:

    POST /rest/v10/Leads/filter

    {
        "fields": "id,date_modified,first_name,last_name",
        "filter": [
            {
                "$and": [
                    {
                        "date_modified": {
                            "$gte": "2021-10-17T23:12:15+00:00"
                        }
                    },
                    {
                        "date_modified": {
                            "$lt": "2021-10-23T01:04:43+00:00"
                        }
                    },
                    {
                        "id": {
                            "$in": [
                                "0719c890-2fa0-11ec-8dd2-0221da82edeb",
                                "0711ba6a-2fa0-11ec-8b02-0221da82edeb",
                                "07091018-2fa0-11ec-ac61-0221da82edeb",
                                "06ffe3a8-2fa0-11ec-a2f1-0221da82edeb",
                                "06f6e65e-2fa0-11ec-8c2e-0221da82edeb",
                                "06ee9922-2fa0-11ec-a3bc-0221da82edeb",
                                "06e6ad48-2fa0-11ec-bda2-0221da82edeb"
                            ]
                        }
                    }
                ]
            }
        ],
        "max_num": 10,
        "offset": 0,
        "order_by": "date_modified:DESC,id:DESC"
    }

    Hope it helps!

    --

    Enrico Simonetti

    Sugar veteran (from 2007)

    www.naonis.tech


    Feel free to reach out for consulting regarding:

    • API Integration and Automation Services
    • Sugar Architecture
    • Sugar Performance Optimisation
    • Sugar Consulting, Best Practices and Technical Training
    • AWS and Sugar Technical Help
    • CTO-as-a-service
    • Solutions-as-a-service
    • and more!

    All active SugarCRM certifications

    Actively working remotely with customers based in APAC and in the United States

Children
No Data