Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

API: Inconsistent query behavior of /conversation #233

Open
mrsimpson opened this issue Mar 30, 2018 · 3 comments
Open

API: Inconsistent query behavior of /conversation #233

mrsimpson opened this issue Mar 30, 2018 · 3 comments
Assignees

Comments

@mrsimpson
Copy link
Collaborator

mrsimpson commented Mar 30, 2018

When using the API to find a conversation in Smarti with a given ID from Rocket.Chat, a query-parameter needs to be supplied. There is none documented, but ?channel_id=... like in the legacy-endpoint does not work.

Also noticed: When supplying a non-existant channel_id as filter, it returns documents which don't match the query. This is not expected

| => curl -X GET --header 'Accept: application/json' --header 'X-Auth-Token: 86ae4861b24dfecb22c74438c1753b7f886cba99/3X2rJ578' 'http://localhost:8080/conversation?channel_id=**smarti-test-topic-87**'
{
"content" : [ {
"id" : "5abdde051e300803b483b97e",
"meta" : {
"status" : "Complete",
"support_area" : [ "smarti-test-topic" ],
"channel_id" : [ "dvp46FtD7xZX3SjnG" ]
},
"user" : {
"id" : "rocketchat.internal.admin.test"
},

@mrsimpson mrsimpson changed the title API: Query filter not applied properly API: How to filter for a conversation with a given channel id? Mar 30, 2018
@mrsimpson
Copy link
Collaborator Author

mrsimpson commented Mar 30, 2018

Also, I noticed that there are conversations which are effectively available, but are not returned via the query.
The conversation exists:

| => curl -X GET --header 'Accept: application/json' --header 'X-Auth-Token: 86ae4861b24dfecb22c74438c1753b7f886cba99/3X2rJ578' 'http://localhost:8080/conversation/5abde7021e300803b483b990'
{
  "id" : "5abde7021e300803b483b990",
  "meta" : {
    "status" : "New",
    "support_area" : [ "smarti-test-topic" ],
    "channel_id" : [ "C5Muv6Mu2SrKfoKrG" ]
  },
  "user" : {
    "id" : "rocketchat.internal.admin.test"
  },
  "messages" : [ {
    "id" : "EqXxMuHd5dMgtmKcn",
    "time" : 1522394882279,
    "origin" : "User",
    "content" : "Diese Nachricht soll editiert werden",
    "user" : {
      "id" : "rocketchat.internal.admin.test"
    },
    "votes" : 0,
    "metadata" : { },
    "private" : false
  } ],
  "context" : {
    "contextType" : "rocket.chat",
    "environment" : { }
  },
  "lastModified" : 1522394882310
}

This very conversation it not found via the query (/conversation):

{
  "content" : [ {
    "id" : "5abdde051e300803b483b97e",
    "meta" : {
      "status" : "Complete",
      "support_area" : [ "smarti-test-topic" ],
      "channel_id" : [ "dvp46FtD7xZX3SjnG" ]
    },
    "user" : {
      "id" : "rocketchat.internal.admin.test"
    },
    "messages" : [ {
      "id" : "3CA8odZ2ncKkcidMq",
      "time" : 1522392581057,
      "origin" : "User",
      "content" : "Mit allgemeinen Anfragen verschaffen Sie sich einen Überblick über den Markt, indem Sie Produkte, Preise und Bestellbedingungen unterschiedlicher Lieferanten und Dienstleister kennen lernen. In einem allgemeinen Anfragebrief bitten Sie zum die Zusendung von Katalogen, Prospekten, Preislisten und Produktmustern. Wie kann ich dieses Wissen nutzen?",
      "user" : {
        "id" : "rocketchat.internal.admin.test"
      },
      "votes" : 0,
      "metadata" : { },
      "private" : false
    } ],
    "context" : {
      "contextType" : "rocket.chat",
      "environment" : { }
    },
    "lastModified" : 1522392582405
  }, {
    "id" : "5abdde0e1e300803b483b97f",
    "meta" : {
      "status" : "Complete",
      "support_area" : [ "smarti-test-topic" ],
      "channel_id" : [ "AXF9MALjQQ4e5YyWB" ]
    },
    "user" : {
      "id" : "rocketchat.internal.admin.test"
    },
    "messages" : [ {
      "id" : "T5rnMe6HegWFNxXsJ",
      "time" : 1522392590595,
      "origin" : "User",
      "content" : "Mit allgemeinen Anfragen verschaffen Sie sich einen Überblick über den Markt, indem Sie Produkte, Preise und Bestellbedingungen unterschiedlicher Lieferanten und Dienstleister kennen lernen. In einem allgemeinen Anfragebrief bitten Sie zum die Zusendung von Katalogen, Prospekten, Preislisten und Produktmustern. Wie kann ich dieses Wissen nutzen?",
      "user" : {
        "id" : "rocketchat.internal.admin.test"
      },
      "votes" : 0,
      "metadata" : { },
      "private" : false
    }, {
      "id" : "BL5ntv6ZKQ9N5xaPG",
      "time" : 1522392591381,
      "origin" : "User",
      "content" : "I found a related message:",
      "user" : {
        "id" : "rocketchat.internal.admin.test"
      },
      "votes" : 0,
      "metadata" : { },
      "private" : false
    } ],
    "context" : {
      "contextType" : "rocket.chat",
      "environment" : { }
    },
    "lastModified" : 1522392592503
  }, {
    "id" : "5abdde141e300803b483b980",
    "meta" : {
      "status" : "New",
      "support_area" : [ "smarti-test-topic" ],
      "channel_id" : [ "vyKmms6wzSRMcmjju" ]
    },
    "user" : {
      "id" : "rocketchat.internal.admin.test"
    },
    "messages" : [ {
      "id" : "EY8RXyshgMnSAMbQS",
      "time" : 1522392596788,
      "origin" : "User",
      "content" : "Diese Nachricht soll editiert werden",
      "user" : {
        "id" : "rocketchat.internal.admin.test"
      },
      "votes" : 0,
      "metadata" : { },
      "private" : false
    } ],
    "context" : {
      "contextType" : "rocket.chat",
      "environment" : { }
    },
    "lastModified" : 1522392596835
  }, {
    "id" : "5abddf7e1e300803b483b982",
    "meta" : {
      "status" : "Complete",
      "support_area" : [ "smarti-test-topic" ],
      "channel_id" : [ "2EDymTDLoHAKRt5NJ" ]
    },
    "user" : {
      "id" : "rocketchat.internal.admin.test"
    },
    "messages" : [ {
      "id" : "Pdgg3XhnSrAoqYtLZ",
      "time" : 1522392958668,
      "origin" : "User",
      "content" : "Mit allgemeinen Anfragen verschaffen Sie sich einen Überblick über den Markt, indem Sie Produkte, Preise und Bestellbedingungen unterschiedlicher Lieferanten und Dienstleister kennen lernen. In einem allgemeinen Anfragebrief bitten Sie zum die Zusendung von Katalogen, Prospekten, Preislisten und Produktmustern. Wie kann ich dieses Wissen nutzen?",
      "user" : {
        "id" : "rocketchat.internal.admin.test"
      },
      "votes" : 0,
      "metadata" : { },
      "private" : false
    } ],
    "context" : {
      "contextType" : "rocket.chat",
      "environment" : { }
    },
    "lastModified" : 1522392960130
  }, {
    "id" : "5abddf881e300803b483b983",
    "meta" : {
      "status" : "Complete",
      "support_area" : [ "smarti-test-topic" ],
      "channel_id" : [ "B8hu6RjEnxdaiTfks" ]
    },
    "user" : {
      "id" : "rocketchat.internal.admin.test"
    },
    "messages" : [ {
      "id" : "Kbzbnp2R6sS7RncHi",
      "time" : 1522392968721,
      "origin" : "User",
      "content" : "Mit allgemeinen Anfragen verschaffen Sie sich einen Überblick über den Markt, indem Sie Produkte, Preise und Bestellbedingungen unterschiedlicher Lieferanten und Dienstleister kennen lernen. In einem allgemeinen Anfragebrief bitten Sie zum die Zusendung von Katalogen, Prospekten, Preislisten und Produktmustern. Wie kann ich dieses Wissen nutzen?",
      "user" : {
        "id" : "rocketchat.internal.admin.test"
      },
      "votes" : 0,
      "metadata" : { },
      "private" : false
    }, {
      "id" : "EMMyqtHv7DJRj7M6H",
      "time" : 1522392969719,
      "origin" : "User",
      "content" : "I found a related message:",
      "user" : {
        "id" : "rocketchat.internal.admin.test"
      },
      "votes" : 0,
      "metadata" : { },
      "private" : false
    } ],
    "context" : {
      "contextType" : "rocket.chat",
      "environment" : { }
    },
    "lastModified" : 1522392970852
  }, {
    "id" : "5abddf8f1e300803b483b984",
    "meta" : {
      "status" : "New",
      "support_area" : [ "smarti-test-topic" ],
      "channel_id" : [ "Cjg27LnDekRszNXCE" ]
    },
    "user" : {
      "id" : "rocketchat.internal.admin.test"
    },
    "messages" : [ {
      "id" : "cTjwwHsx5DCr4R4yX",
      "time" : 1522392975315,
      "origin" : "User",
      "content" : "Diese Nachricht soll editiert werden",
      "user" : {
        "id" : "rocketchat.internal.admin.test"
      },
      "votes" : 0,
      "metadata" : { },
      "private" : false
    } ],
    "context" : {
      "contextType" : "rocket.chat",
      "environment" : { }
    },
    "lastModified" : 1522392975355
  }, {
    "id" : "5abde4d81e300803b483b986",
    "meta" : {
      "status" : "Complete",
      "support_area" : [ "smarti-test-topic" ],
      "channel_id" : [ "uD9cMkhatLNPLySBi" ]
    },
    "user" : {
      "id" : "rocketchat.internal.admin.test"
    },
    "messages" : [ {
      "id" : "MQtsM2gjnKskJeXbR",
      "time" : 1522394328606,
      "origin" : "User",
      "content" : "Mit allgemeinen Anfragen verschaffen Sie sich einen Überblick über den Markt, indem Sie Produkte, Preise und Bestellbedingungen unterschiedlicher Lieferanten und Dienstleister kennen lernen. In einem allgemeinen Anfragebrief bitten Sie zum die Zusendung von Katalogen, Prospekten, Preislisten und Produktmustern. Wie kann ich dieses Wissen nutzen?",
      "user" : {
        "id" : "rocketchat.internal.admin.test"
      },
      "votes" : 0,
      "metadata" : { },
      "private" : false
    } ],
    "context" : {
      "contextType" : "rocket.chat",
      "environment" : { }
    },
    "lastModified" : 1522394330120
  }, {
    "id" : "5abde4e21e300803b483b987",
    "meta" : {
      "status" : "Complete",
      "support_area" : [ "smarti-test-topic" ],
      "channel_id" : [ "bLtpS3Myzs4B8tYwr" ]
    },
    "user" : {
      "id" : "rocketchat.internal.admin.test"
    },
    "messages" : [ {
      "id" : "Jbg4CRvc6krHZQXLP",
      "time" : 1522394338684,
      "origin" : "User",
      "content" : "Mit allgemeinen Anfragen verschaffen Sie sich einen Überblick über den Markt, indem Sie Produkte, Preise und Bestellbedingungen unterschiedlicher Lieferanten und Dienstleister kennen lernen. In einem allgemeinen Anfragebrief bitten Sie zum die Zusendung von Katalogen, Prospekten, Preislisten und Produktmustern. Wie kann ich dieses Wissen nutzen?",
      "user" : {
        "id" : "rocketchat.internal.admin.test"
      },
      "votes" : 0,
      "metadata" : { },
      "private" : false
    }, {
      "id" : "Dv2BEvXPLeCnKqk3H",
      "time" : 1522394339765,
      "origin" : "User",
      "content" : "I found a related message:",
      "user" : {
        "id" : "rocketchat.internal.admin.test"
      },
      "votes" : 0,
      "metadata" : { },
      "private" : false
    } ],
    "context" : {
      "contextType" : "rocket.chat",
      "environment" : { }
    },
    "lastModified" : 1522394341041
  }, {
    "id" : "5abde4e91e300803b483b988",
    "meta" : {
      "status" : "New",
      "support_area" : [ "smarti-test-topic" ],
      "channel_id" : [ "S4iLX4eHSbwYDMKZv" ]
    },
    "user" : {
      "id" : "rocketchat.internal.admin.test"
    },
    "messages" : [ {
      "id" : "swsF9xmHop5gQ4fvy",
      "time" : 1522394345512,
      "origin" : "User",
      "content" : "Diese Nachricht soll editiert werden",
      "user" : {
        "id" : "rocketchat.internal.admin.test"
      },
      "votes" : 0,
      "metadata" : { },
      "private" : false
    } ],
    "context" : {
      "contextType" : "rocket.chat",
      "environment" : { }
    },
    "lastModified" : 1522394345546
  }, {
    "id" : "5abde6821e300803b483b98a",
    "meta" : {
      "status" : "Complete",
      "support_area" : [ "smarti-test-topic" ],
      "channel_id" : [ "iAWyjBbdjhDWt7fvP" ]
    },
    "user" : {
      "id" : "rocketchat.internal.admin.test"
    },
    "messages" : [ {
      "id" : "i8h8AoQ9HyzEdbZm6",
      "time" : 1522394754822,
      "origin" : "User",
      "content" : "Mit allgemeinen Anfragen verschaffen Sie sich einen Überblick über den Markt, indem Sie Produkte, Preise und Bestellbedingungen unterschiedlicher Lieferanten und Dienstleister kennen lernen. In einem allgemeinen Anfragebrief bitten Sie zum die Zusendung von Katalogen, Prospekten, Preislisten und Produktmustern. Wie kann ich dieses Wissen nutzen?",
      "user" : {
        "id" : "rocketchat.internal.admin.test"
      },
      "votes" : 0,
      "metadata" : { },
      "private" : false
    } ],
    "context" : {
      "contextType" : "rocket.chat",
      "environment" : { }
    },
    "lastModified" : 1522394756461
  } ],
  "last" : false,
  "totalElements" : 15,
  "totalPages" : 2,
  "size" : 10,
  "number" : 0,
  "sort" : null,
  "numberOfElements" : 10,
  "first" : true

This can be reproduced via an integration-test: assistify/Rocket.Chat@da51bb4

| ~/projects/Rocket.Chat @ Olivers-MBP (oliverjaegle) 
| => cp tests/end-to-end/ui_smarti/00-preparation.js tests/end-to-end/temporary_staged_test/

| ~/projects/Rocket.Chat @ Olivers-MBP (oliverjaegle) 
| => .scripts/continueTesting.sh 

@mrsimpson mrsimpson changed the title API: How to filter for a conversation with a given channel id? API: Inconsistent query behavior of /conversation Mar 30, 2018
@mrsimpson
Copy link
Collaborator Author

I just noticed that the missing conversation in the generic query could be due to pagination. Once cleaned-up, the tests run successfully! So only the issue with "how to query a conversation" remains

@westei
Copy link
Member

westei commented Apr 1, 2018

This is not implemented. The GET /conversation does not have any support for query parameters that filter conversations

@westei westei self-assigned this Jun 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants