# Populate Data Explorer params with URL params

**URL:** https://meta.discourse.org/t/populate-data-explorer-params-with-url-params/169404
**Category:** Feature
**Tags:** data-explorer, completed
**Created:** [November 6, 2020, 7:28am UTC](https://meta.discourse.org/t/populate-data-explorer-params-with-url-params/169404 "2020-11-06T07:28:25Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Nacho\_Caballero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nacho_caballero/32/130189_2.png) [@Nacho\_Caballero](https://meta.discourse.org/u/Nacho_Caballero)
#### Post date: [November 6, 2020, 7:28am UTC](https://meta.discourse.org/t/populate-data-explorer-params-with-url-params/169404/1 "2020-11-06T07:28:25Z")

</div>

It would be great if I could share a [Data Explorer](https://meta.discourse.org/t/32566?silent=true) query with a group and have the query params be pre-filled with the URL params.

For example, if I have this param `-- string :username`, I should be able to share it with group “my-group” with username “myName”.

Something like this:

```plaintext
https://mydomain.com/g/my-group/reports/100?username=myName

```

 ![image](https://global.discourse-cdn.com/meta/original/3X/4/1/41411bf810f395accd3c5433995c312be352b928.png)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [November 9, 2020, 3:53am UTC](https://meta.discourse.org/t/populate-data-explorer-params-with-url-params/169404/2 "2020-11-09T03:53:43Z")

</div>

Sure … putting a #pr-welcome on this, seems like a nice quality of life change!

---

<div class="post-metadata">

### Author: ![loginerror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/loginerror/32/156605_2.png) [@loginerror](https://meta.discourse.org/u/loginerror)
#### Post date: [February 12, 2021, 9:09am UTC](https://meta.discourse.org/t/populate-data-explorer-params-with-url-params/169404/4 "2021-02-12T09:09:30Z")

</div>

Bumping the topic with one more suggestion:

- having a `&run` parameter that will fire report upon page load, to save user a click
- having set of parameters that would carry user context (this way you could auto-insert the username of the current user, for example)

We would like this feature because it would allow us to easily automate internal notifications for topics for each interested user 🙂

---

<div class="post-metadata">

### Author: ![lucasbasquerotto](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lucasbasquerotto/32/133376_2.png) [@lucasbasquerotto](https://meta.discourse.org/u/lucasbasquerotto)
#### Post date: [February 12, 2021, 11:56am UTC](https://meta.discourse.org/t/populate-data-explorer-params-with-url-params/169404/5 "2021-02-12T11:56:20Z")

</div>

It’s just important to note that if a `run` parameter is added, it should not be used if the `same-site` cookie is set to `None` (or `Disabled` and the browser defines `None` as the default).

If the `same-site` is `none`, you could enter some other site and they could make a http GET request, in the same way that CSRF is exploited, although this would not be a CSRF vulnerability per se, but they could execute some really expensive instructions in the [data explorer](https://meta.discourse.org/t/32566?silent=true).

The `same-site` cookie policy is relatively new, but the major browsers already support it for some time, Chrome defaults to Lax, and Discourse too (if I’m not wrong), so it should not be a problem in most cases.

---

<div class="post-metadata">

### Author: ![Nam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nam/32/383046_2.png) [@Nam](https://meta.discourse.org/u/Nam)
#### Post date: [July 28, 2021, 6:24pm UTC](https://meta.discourse.org/t/populate-data-explorer-params-with-url-params/169404/6 "2021-07-28T18:24:03Z")

</div>

I added the [Data Explorer](https://meta.discourse.org/t/32566?silent=true) params to the URL. The Params are added when the user press ‘run’ button.  
This is the example after press ‘run’:  
 ![Screen Shot 2021-07-28 at 1.19.56 PM](https://global.discourse-cdn.com/meta/optimized/3X/8/e/8e32d3e3bbe60272fabcf84af1cec333c8cbb61f_2_690x34.png)

 ![Screen Shot 2021-07-28 at 1.20.17 PM](https://global.discourse-cdn.com/meta/original/3X/6/7/6787f6650ddb044d32860849a4c0b1a23793a8e8.png)  
and here is the link for the PR:  
[https://github.com/discourse/discourse-data-explorer/pull/128](https://github.com/discourse/discourse-data-explorer/pull/128)

---

<div class="post-metadata">

### Author: ![markvanlan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/markvanlan/32/160087_2.png) [@markvanlan](https://meta.discourse.org/u/markvanlan)
#### Post date: [October 8, 2021, 2:45am UTC](https://meta.discourse.org/t/populate-data-explorer-params-with-url-params/169404/7 "2021-10-08T02:45:58Z")

</div>

The PR linked above was merged. Does this accomplish what you were looking for? You have to run the query to have the query params added to the URL, so you can run it, copy the link, and share.

---

<div class="post-metadata">

### Author: ![Nacho\_Caballero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nacho_caballero/32/130189_2.png) [@Nacho\_Caballero](https://meta.discourse.org/u/Nacho_Caballero)
#### Post date: [October 21, 2021, 10:10am UTC](https://meta.discourse.org/t/populate-data-explorer-params-with-url-params/169404/8 "2021-10-21T10:10:02Z")

</div>

@Nam Thanks for your work on this!

This currently works for queries run in the [Data explorer](https://meta.discourse.org/t/32566?silent=true), but I wonder if it would be possible to make this work as a report. Something like:

`mysite.com/g/my-group/reports/6&params=%7B"months_ago"%3A"3"%7D`

---

<div class="post-metadata">

### Author: ![markvanlan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/markvanlan/32/160087_2.png) [@markvanlan](https://meta.discourse.org/u/markvanlan)
#### Post date: [October 25, 2021, 2:28pm UTC](https://meta.discourse.org/t/populate-data-explorer-params-with-url-params/169404/9 "2021-10-25T14:28:44Z")

</div>

We could add support for filling the inputs on the groups report run page, with params from the URL. That wouldn’t be difficult at alI. The question I have is, how do you get this URL? Is it generated for a given group somehow, or are you just manually generating the URL?

---

<div class="post-metadata">

### Author: ![Nacho\_Caballero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nacho_caballero/32/130189_2.png) [@Nacho\_Caballero](https://meta.discourse.org/u/Nacho_Caballero)
#### Post date: [October 25, 2021, 3:38pm UTC](https://meta.discourse.org/t/populate-data-explorer-params-with-url-params/169404/10 "2021-10-25T15:38:14Z")

</div>

If you go to the group page, you’ll see a “Reports” tab with links to the queries that are available for that group, but the params would probably have to generated manually.

---

<div class="post-metadata">

### Author: ![markvanlan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/markvanlan/32/160087_2.png) [@markvanlan](https://meta.discourse.org/u/markvanlan)
#### Post date: [October 25, 2021, 3:40pm UTC](https://meta.discourse.org/t/populate-data-explorer-params-with-url-params/169404/11 "2021-10-25T15:40:41Z")

</div>

Okay, I’ll add support for filling in the inputs in the groups report show page, with params from the URL.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [July 4, 2024, 5:57am UTC](https://meta.discourse.org/t/populate-data-explorer-params-with-url-params/169404/14 "2024-07-04T05:57:51Z")

</div>

I thinks we never got to this? I can certainly see it being useful.

---

<div class="post-metadata">

### Author: ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)
#### Post date: [July 5, 2024, 9:16am UTC](https://meta.discourse.org/t/populate-data-explorer-params-with-url-params/169404/16 "2024-07-05T09:16:51Z")

</div>

This PR should be able to make up for it:

[https://github.com/discourse/discourse-data-explorer/pull/298](https://github.com/discourse/discourse-data-explorer/pull/298)

> [@Nacho\_Caballero](#):
>
> Something like:
> 
> `mysite.com/g/my-group/reports/6&params=%7B"months_ago"%3A"3"%7D`

Its effect is as shown in the above quote

 ![image](https://global.discourse-cdn.com/meta/original/4X/1/3/c/13ce0f0f5b8a5949c5954023b4f0175ef5b9bdad.png)

---

<div class="post-metadata">

### Author: ![nat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nat/32/235063_2.png) [@nat](https://meta.discourse.org/u/nat)
#### Post date: [July 16, 2024, 3:57am UTC](https://meta.discourse.org/t/populate-data-explorer-params-with-url-params/169404/17 "2024-07-16T03:57:20Z")

</div>



---

<div class="post-metadata">

### Author: ![hugh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hugh/32/336717_2.png) [@hugh](https://meta.discourse.org/u/hugh)
#### Post date: [September 3, 2025, 12:51am UTC](https://meta.discourse.org/t/populate-data-explorer-params-with-url-params/169404/20 "2025-09-03T00:51:53Z")

</div>

> [@loginerror](#):
>
> having a `&run` parameter that will fire report upon page load, to save user a click

We circled back to this request and have now added a `run` paramater that will automatically run the report when the page is loaded. It is documented in the [Data Explorer](https://meta.discourse.org/t/32566?silent=true) plugin page here:

> [@Discourse Data Explorer](https://meta.discourse.org/t/discourse-data-explorer/32566/1):
>
> While you can always run a query by clicking the Run button, you can save time when loading a query by adding the `run` parameter to the URL.
> 
> For example: `/admin/plugins/explorer/queries/123?run`
