Announcement

Collapse
No announcement yet.

API Example for searchParams for postman call

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • API Example for searchParams for postman call

    Hi guys,

    in API documentation I have found the following:
    "As of v7.0.0 it's possible to pass all parameters in JSON format in one query paramerer searchParams."

    Assume I have an entity "MyEntity" and the fields/attribute "status" which can have 3 values: "not started","in progress","done" and I want to filter/search for all "done".

    How would a typical curls/postman/http call would look like?

    I have tried so far:
    https://myserver/api/v1/MyEntity?searchParams="{where:[type:'equals',attribute:'status',value:'done']}" --> failed

    Although it is not really JSON fromat I also tried this one:
    https://myserver/api/v1/MyEntity?searchParams={maxSize: 100, 'where[0][type]': 'equals', 'where[0][attribute]': 'status', 'where[0][value]': 'working'} --> failed

    Also tried this one:
    https://myserver/api/v1/MyEntity?where={'where[0][type]': 'equals', 'where[0][attribute]': 'status', 'where[0][value]': 'working'} --> failed

    How would a http request would look like without searchParams if I want to just use the where (?)

    I had a detailed look into https://github.com/espocrm/documenta...rams.md#params but as I am trying it with postman i could not use the code snippets documented there and tried to transform it to postman calls, but all of my tries with "where" failed so far, "select" parameter works fine.

    Some curl examples / http request examples would be appreciated and helpful.
    Thanks in advance.
    Last edited by STARFLEET; 09-26-2021, 01:55 PM.

  • #2
    Example:

    http://espocrm.domain/api/v1/Account?searchParams={
    "select": ["id", "name","powiat"],
    "where": [{"type": "contains", "attribute": "name", "value": "Warszawa"}],
    "maxSize": 30,
    "orderBy": "createdAt",
    "order": "desc"
    }​

    Comment

    Working...
    X