issues with the info retrieved by API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • esendino
    Senior Member
    • May 2019
    • 158

    issues with the info retrieved by API

    Im doing a GET request to a custom entity.

    That entity has a relationship many to many with other custom entity

    The problem: I don't retrieve the info with the links with that relationship

    The details:

    Entity I made the GET: WooProductCategory
    Entity related: WooProduct
    Linking Field wooProductsIds.


    Click image for larger version

Name:	image.png
Views:	215
Size:	18.5 KB
ID:	89929
    I do the GET with the following URL


    URL: https://boxspace.essenzial.es/api/v1...89d894b7af3088


    I have ensured that that record really has a relationship with two WooProduct records

    The call to the API provides a "200" status code answer and I retrieve the following JSON:


    {
    "id":"64189d894b7af3088",
    "name":"135",
    "deleted":false,
    "description":null,
    "createdAt":"2023-03-20 17:53:13",
    "modifiedAt":"2023-03-24 20:15:20",
    "count":9,
    "display":"default",
    "menuOrder ":null,
    "parent":0,
    "slug":"gxc-guarda-por-cajas",
    "versionIT":null,
    "nombre":"GXC - GUARDA POR CAJAS",
    "borrado":"Activo",
    "createdById":"628967ae3 9dc7f5e7",
    "createdByName":"make_con_key",
    "modified ById":"5ba4940d1778e47b2",
    "modifiedByName":"Erge Seanle",
    "assignedUserId":"5f71c1103d3a88c43",
    "ass ignedUserName":"Bot espoCRM",
    "teamsIds":["5ce19fe2dc9f3d2ec"],
    "teamsNames":{"5ce19fe2dc9f3d2ec":"Cobranzas"}
    }

    But in the info I'm missing the linking field wooProductsIds​​

    Cant see what I have wrongly done. Any idea?

    PD. I have tried to use the select clause to "force" the retrieval, but with no success.



  • lazovic
    Super Moderator
    • Jan 2022
    • 810

    #2
    Hi esendino,

    Unfortunately, I cannot reproduce your error. Two custom entities were created, a relationsips between them was established and several test records were created.

    Entity made the GET: Test
    Entity related: Test1​

    Click image for larger version

Name:	image.png
Views:	241
Size:	17.8 KB
ID:	90214

    Code:
    {
        "id": "642bf9b9a12054b08",
        "name": "1",
        "deleted": false,
        "description": null,
        "createdAt": "2023-04-04 10:19:37",
        "modifiedAt": "2023-04-04 10:24:01",
        "createdById": "6411e441336e27a46",
        "createdByName": "Admin",
        "modifiedById": "6411e441336e27a46",
        "modifiedByName": "Admin",
        "assignedUserId": null,
        "assignedUserName": null,
        "teamsIds": [],
        "teamsNames": {},
        "test1sIds": ["642bfab72cc0bab01", "642bfab205c4b755c"],
        "test1sNames": {
            "642bfab72cc0bab01": "2",
            "642bfab205c4b755c": "1"
        }
    }​​
    Please tell me which version of EspoCRM are you using? Does the same situation happen between related default and custom entities, for example?

    Comment

    • yuri
      Member
      • Mar 2014
      • 8501

      #3
      You need either to enable link-multiple field for the relationship. Or make a separate call to retrieve linked records. The latter is preferable if there can be big number of related records.
      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

      Comment

      Working...