blog
As an enthusiastic App Store publisher, I just published a new version of the JWT and Queue module. I clicked around to see how much the modules were downloaded, which gives a good impression of the value and popularity of the modules. I was happy that they passed the 100 downloads. Then I came across the Cat Connector, which was downloaded 126 times. Suddenly I was blown away by the creativity my limited brain capacity could not grasp. How could something completely useless like an implementation of TheCatAPI.com get 126 downloads? I had to laugh and could identify myself with the joy of creating something funny and useless once in a while. Who doesn’t?
The fact that most the modules I published were less popular than the Cat Connector, bothered me, although the first release of the Cat Connector was dated two years ago. Maybe I should inflate the number of downloads a little bit? No, that’s not funny. What would be funnier than the idea of the Cat Connector itself? The Cat Connector being the most downloaded App Store module, more than the Mendix blank App template! I clicked the Download button in the App Store and looked whether the +1 was added to the number of downloads. Nope, that was not working. I felt a strong urge to find out how the App Store was counting the downloads and decided on what would be my goal this evening.
When downloading the Cat Connector in the Mendix Modeler, the +1 is counted. The first thing I had to figure out, how the App Store content in the Modeler is processed. I used the Postman “Capture API requests” feature to setup a proxy on localhost. As soon as I restarted the Modeler I received the following warning.
The Modeler detected I was messing around with the connection and asked whether I wanted to accept the proxy certificate. As soon as I accepted the certificate, the fireworks started. A burst of API requests were shown in Postman, which gave me a very nice impression of the non-public side of the Mendix environment, full of SOAP web-services. I downloaded the Cat Connctor and observed a POST request using the GetDownloadUrl operation with username “modelerguest” and password “modelerguest”. So I could download any App Store module on behalf of the modeler?! That sounded too good to be true. Wait… the XML-tag <EmployeeName> contained my email address. What if I just fill in an email address of any random Mendix user? I exported the call to the following curl request:
curl -s -o /dev/null -X POST \ https://appstore.home.mendix.com/ws/AppStoreServiceMx6_2/ \ -H 'accept-encoding: gzip, deflate' \ -H 'cache-control: no-cache' \ -H 'content-type: text/xml; charset=utf-8' \ -H 'host: appstore.home.mendix.com' \ -H 'soapaction: "urn:AppStoreGetDownloadUrl"' \ -d '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><h:authentication xmlns:h="urn:AppStore" xmlns="urn:AppStore" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><username xmlns="">modelerguest</username><password xmlns="">modelerguest</password></h:authentication></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetDownloadUrl xmlns="urn:AppStore"><versionNumber xmlns="">{AppStoreModuleVersionNumber}</versionNumber><EmployeeName xmlns="">{RandomEmail}</EmployeeName></GetDownloadUrl></s:Body></s:Envelope>'
Just fired the call and it worked! +1! I created a bash script that would run 10 calls in parallel and will soon promote the Cat Connector to the most popular module! Aiiiii, the App Store did not like that one. The download counter was suffering from the concurrent requests and was changing numbers up and down. In addition, the App Store was getting unresponsive, sorry for that! I stopped and decided to take another approach. I implemented one request at the time and a sleep between 1 and 10 seconds between each request to gradually increase the number of downloads.
It would take a while to get the almost 30.000 App Store downloads of the Mendix blank App template and I did not want to leave my laptop running for a few days. Using SSH I hijacked a container running a Mendix application. In the background I started the bash script. Per hour the script would simulate (3600 / ((1+10) / 2)) = 655 downloads. Probably I would need to run it for less than two days to get to 30.000 App Store downloads. My brain felt satisfied. Finally I was able to close my laptop, go to bed for a good sleep and dream about cats.
A message to the Mendix Community Team: my apologies for messing around with numbers! Feel free to deploy a one time microflow to reset the count of the Cat Connector module to 126.