Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
 
Answered
How do I add a request to my coreflow

I can see in the examples how to mock a response, but I haven't seen a strong example of actually sending xml to the core in a request. I know what the request and response should look like, but I don't know how the xml should be formatted within the query when sending the core request.

Posted 2 years ago
Votes Newest

Answers


Hi Caleb,

In your query object within the coreflow is where you would construct the request. In the example query below an xml string of <ExampleRequest>123456789</ExampleRequest> gets produced. The build() method is what's responsible for constructing whatever the shape is. I'd setup a test where you have your known good request string in a file (test these by hand and make sure they are what you expect), then in the test construct the query object and call the build() method which gets asserted to your known request string.

class GetEmailQuery(BaseQuery):
    def __init__(self,
                 logger: logging.Logger,
                 customer_id: str,
                 mock_failure=False
                ):
        self.customer_id = customer_id
        super().__init__(logger)
				
	def build(self) -> str:
    """
    Constructs and returns the core request from a template and provided parameters.
    """
    root = lxml.etree.Element('ExampleRequest')
    root.text = self.customer_id

    xml_as_bytes = lxml.etree.tostring(root)
    return xml_as_bytes.decode('utf8')
Posted one year ago
Jason Herbert
104 × 1 Administrator
0

Are there any headers automatically added to a core request coming from a coreflow. I just want to make sure that the request is going to the proper url and has the necessary keys for access

— Caleb Evans   one year ago