Put saved-searches API returns "400 Bad Request"

Hi all,

I’ve succesfully retrieved a saved search via “GET …/v3/saved-searches/id”. However, the “PUT …/v3/saved-searches/id” call to update the saved search fails with status code 400. The json body of the PUT call is almost identical to that of the GET call (I just wanted to remove some columns from the search output). Has anyone encountered the same problem before and was able to found a solution to this problem ?

Thanks for your feedback

It looks like you have a malformed request. Your error response is in HTML when it should be in JSON. That tells me your request probably isn’t setup correctly. Can you share the cURL code snippet for your request, minus the authorization header so we don’t see your token? You can generate it by clicking on the code icon on the right and selecting cURL from the dropdown.

image

image

Hi Colin, here is the CURL extracted from postman.

curl --location --request PUT 'https://xxxxxx.api.identitynow.com/v3/saved-searches/8e89eec3-9b0d-4370-a170-a757560aba2f' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbG..' \
--data-raw '{
    "id": "8e89eec3-9b0d-4370-a170-a757560aba2f",
    "name": "_exists_:attributes.onboarded AND _exists_:attributes.baso",
    "description": "_exists_:attributes.onboarded AND _exists_:attributes.baso",
    "owner": {
        "type": "IDENTITY",
        "id": "2c9180857a34439f017a3863cf44190b"
    },
    "public": false,
    "indices": [
        "identities"
    ],
    "columns": {
        "identity": [
            {
                "field": "displayName",
                "header": "Display Name"
            },
            {
                "field": "firstName",
                "header": "First Name"
            },
            {
                "field": "lastName",
                "header": "Last Name"
            },
            {
                "field": "email",
                "header": "Work Email"
            },
            {
                "field": "created",
                "header": "Created"
            },
            {
                "field": "attributes.cloudLifecycleState",
                "header": "Lifecycle State"
            },
            {
                "field": "tags",
                "header": "Tags"
            },
            {
                "field": "attributes.baso",
                "header": "BASO"
            },
            {
                "field": "attributes.onboarded",
                "header": "Onboarded"
            }
        ]
    },
    "query": "_exists_:attributes.onboarded AND _exists_:attributes.baso",
    "fields": null,
    "orderBy": null,
    "sort": [
        "displayName"
    ],
    "filters": null
}'

Regards,
Wim

Try removing the id from your body.

I should have thought of that myself. But even after removing the id of the saved search from the json body, It still returns a 400…

I am able to use this endpoint successfully, but I can’t seem to find any issues with your request. Is there any scenario where you can successfully call this endpoint? Maybe try updating a different search, or use a request body that doesn’t change any fields.