Create "app" configuration and 'custom dimension" only with one codevia Piwik Pro API

Hello the Piwik Pro Team and the Piwik Community,

I’m a newbee in the use of the API.
I would like to know if it’s possible to create a new “app” configuration and also 'custom dimensions" only with one code via Piwik Pro API ?
If so do you provide some examples please ?

Thanks in advance for your kindly support.
Kind regards,
Sébastien

Hey Sébastien,
you would need to use 2 API calls here: one to create a new App and one to create custom dimensions.

To create a new App you can use /api/apps/v2 endpoint.
As you can see in our documentation, the required attributes are name and urls. On the right, you can expand the sample request or you can use the one below:

{
    "data": {
        "type": "ppms/app",
        "attributes": {
            "name": "New App",
            "urls": [
                "https://example.com"
            ]
        }
    }
}

To create custom dimensions you’d need to use /api/analytics/v1/manage/custom-dimensions/ endpoint. Again, you can also see a sample request on the right. Please remember to change the website_id to the one that you got from creating a new app.

1 Like

Hi @pwachala many than ks for your kindly support & great suggestion.

Have a lovely day. Kind regards, Sébastien

1 Like