Hi! I tried following the docs here (v26) <https:/...
# community-help
j
Hi! I tried following the docs here (v26) https://typesense.org/docs/26.0/api/analytics-query-suggestions.html#sending-click-events but for some reason the response body has missing closing tag:
Copy code
{"ok": true
Here’s the exact steps I did in cli:
Copy code
curl -k "<http://localhost:8108/collections>" \
      -X POST \
      -H "Content-Type: application/json" \
      -H "X-TYPESENSE-API-KEY: xyz" \
      -d '{
        "name": "products",           
        "fields": [       
          {"name": "title", "type": "string"},
          {"name": "popularity", "type": "int32", "optional": true}
        ]                                    
      }'

curl -k "<http://localhost:8108/analytics/rules>" \
      -X POST \
      -H "Content-Type: application/json" \
      -H "X-TYPESENSE-API-KEY: xyz" \
      -d '{
        "name": "products_popularity",
        "type": "counter",
        "params": {
            "source": {
                "collections": ["products"],
                "events":  [
                    {"type": "click", "weight": 1, "name": "products_click_event"}
                ]
            },
            "destination": {
                "collection": "products",
                "counter_field": "popularity"
            }
        }
      }'

curl -k "<http://localhost:8108/analytics/events>" \
     -X POST \
     -H "Content-Type: application/json" \
     -H "X-TYPESENSE-API-KEY: xyz" \
     -d '{
            "type": "click",
            "name": "products_click_event",
            "data": {
                  "q": "nike shoes",
                  "doc_id": "1024",
                  "user_id": "111112"
            }
        }'