copyright | link | is |
---|---|---|
Copyright IBM Corp. 2017 |
search-for-space-content |
future |
This is a sample GraphQL query to search for messages across spaces to which you have access. Here we are requesting messages
matching the string "interesting fact". The collection returned includes a maximum of 50 messages by default; this may be
changed by passing an additional size
parameter. If the total
number of matching messages exceeds the number returned,
successive pages of messages may be obtained using pageInfo
(i.e., to get the next page, pass the endCursor
from pageInfo
as the after
parameter on the next request).
Additional optional parameters may be included as follows:
locale
: Locale string, e.g.en
searchFields
: Message fields in which to search for thequery
string; defaults arecontent
,annotation.content
andannotation.file_name
from
: Sender user ID(s)in
: Space ID(s)dateFrom
: Earliest timestamp to searchdateTo
: Latest timestamp to search
{
searchMessages(query: "interesting fact") {
items {
message {
content
contentType
id
created
createdBy {
displayName
}
}
highlights {
field
highlighted
}
space {
id
title
}
}
pageInfo {
startCursor
endCursor
hasPreviousPage
hasNextPage
}
total
}
}
Try it out with our GraphQL tool - Search for Messages