@Elena_Paraschiv, there are many ways to do so. Ideally, I would expect you to have an application with a Snowplow tracker embedded and use the methods of the tracker. If you do not have any yet (wonder why Snowplow Mini then), then you could use either an HTML link (GET request) with embedded data or curl (either GET or POST). Here’s an example of the curl command with both custom event and a custom entity/contexts attached to it sent via POST (endpoint /com.snowplowanalytics.snowplow/tp2):
Note the event is composed according to Snowplow Tracker Protocol. It uses non-encoded data (hence, ue_pr, and co properties). I provided self-reference to some imaginary JSON schemas “com.acme/event_name/jsonschema/1-0-0” (for custom event) and “com.acme/entity_name/jsonschema/1-0-0” (for custom entity). To use GET requests, use /i endpoint. There are many more depending on the collector adaptor you want to send the data to.
If you want to use any of the JSON schemas hosted by Snowplow, you can refer to Iglu Central. Snowplow Mini automatically queries that repository.
Thank you for your reply @ihor.
Regarding your code snippet can I run it from my local terminal and what suffix extension should I use for it ? I tried curl_test.exe and curl_test.html, but didn’t work. I am sorry for the newbie question, not so familiar with server-side trying to learn it.
You would copy and paste the line @ihor gave you directly into the terminal (after making the edits to the URL) and it should execute immedatiely. The \ you see at the end of each line make this a multiline command.
If you want to save it as a file, then you can save it with the .sh extension, say curl_test.sh, and then in your terminal, navigate to the correct folder and type ./curl_test.sh.
If you get a permission denied: ./curl_test.sh error or similar then you need to make the script executable with chmod +x curl_test.sh.
I think the problem is that the com.acme schema is an imaginary one and not uploaded in the iglu-central/schemas folder.
So I am thinking for simplicity to modify my curl_test.sh as
curl --request POST
–header ‘content-type: application/json’
and created this schema
com.acme/event_name/jsonschema > 1.0.0
and then upload the whole folder with the schema via terminal command : igluctl static push path/to-schema/ http://<Mini-domain-or-IP>/iglu-server <API key> --public as mentioned here . Do you think that makes sense ?
@Elena_Paraschiv, for a start I would like to warn you that Igluctl version to use depends on the version of Snowplow Mini you deployed. If you are using the latest versions of Snowplow Mini (0.9+) then you need to use the latest version of Igluctl as well, which could be downloaded from here, 0.7.1.
The path to the JSON schema is important, it is expected the JSON schema file to be located in schemas/<vendor>/<name>/jsonschema/. In you example, your (text, not shell) file 1-0-0 has to be located in schemas/com.acme/test_schema/jsonschema/ folder. Then if you are in the parent of schemas folder, you would upload the schema(s) to Snowplow Mini the way you did, that is
You also could use the full path to the schemas (./schema/schemas/com.acme/test_schema/jsonschema/1-0-0) if no other schemas are to be uploaded. The main point here the placement of the JSON schemas file in the correct folders.
If you are to upload the JSON schema via UI, the “body” field would contain the content of your JSON schema (the whole JSON).
I am almost there. Your replies have been so helpful @ihor and @PaulBoocock .
Managed to upload the schemas, but there is something wrong with it that I can’t figure out.
When I run lint on it this is what happens
It should be http://22.214.171.124/com.snowplowanalytics.snowplow/tp2 - the com.snowplowanalytics.snowplow part doesn’t refer to the schema for your custom event, it refers to the ‘tracker protocol’ - which is the more generic format of the payload.
In case you didn’t know about them, the snowplow tracking CLI, or looking into one of our trackers might be of interest at this point, now that you seem to be up and running. Eg. I find a python script to be a lot less annoying than curl requests when I want a fast feedback loop for creating/testing custom events.
Nothing wrong with curl requests though, it’s personal preference.