Trying to use the API to create a site

Hi,

I’m trying to use curl to create a new site.

curl -v --data “?module=API&method=SitesManager.addSite&siteName=test.site&urls=http://www.test.site&timezone=CET&currency=CHF&format=xml&token_auth=bla” https://myserver/matomo/

I get a code 302 from this, with a redirect

location: index.php?module=CoreHome&action=index&idSite=1&period=day&date=yesterday

Is there a way to see what has gone wrong?

Using v3.8.1 on PHP 7.3.

Hi,

I’m pretty sure the --data parameter of curl shouldn’t start with ?.

Hi,

thanks, I fixed it by just using “normal” curl requests.
Also found the examples near the top of the page.

I’ll rewrite my perl/shell conglomerate into perl and use libwww…

1 Like