# Perspective URL Dictionary Parameter

**URL:** <https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019>\
**Category:** Ignition\
**Tags:** ignition80, perspective\
**Created:** [August 24, 2020, 12:18pm UTC](https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019 "2020-08-24T12:18:39Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [August 24, 2020, 12:18pm UTC](https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019/1 "2020-08-24T12:18:39Z")

</div>

I know that URL parameters are created by setting /:paramName variables after the path in the Page Configuration screen, however is it possible to pass a dictionary as a URL Paramater?

Other things I have seen online typically take this format `?Val1=1&Val2=3` that equates to `/{"Val1":1,"Val2":3}`

When I try this though it just renders as a string, I know that I could write a script to unpack that dictionary format into a python dictionary, but I am looking for something more native.

Any ideas?

Note: I have a strong feeling this isnt currently possible, and will be a feature request, if so I already made an [ideas post here.](https://ideas.inductiveautomation.com/ignition-features-and-ideas/p/ability-to-pass-dictionary-parameters-to-a-url)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 24, 2020, 12:52pm UTC](https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019/2 "2020-08-24T12:52:55Z")

</div>

FWIW, I still cannot log in to the ideas portal. After an attempt, IA’s SSO just redirects back to [canny.io](http://canny.io), but [canny.io](http://canny.io) doesn’t recognized the login status. Still using a third-party cookie, I presume, instead of a properly secure backend handoff.

---

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [August 24, 2020, 1:44pm UTC](https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019/3 "2020-08-24T13:44:19Z")

</div>

Interestingly enough, even when I switched from my previous company to Design Group, it still works for me?

Sounds like an email for [website@inductiveautomation.com](mailto:website@inductiveautomation.com)

EDIT: Unless @adam.morales knows the trick to fix it

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 24, 2020, 2:46pm UTC](https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019/4 "2020-08-24T14:46:44Z")

</div>

Well, I have ticket 111942 “in progress” (from January) with a comment from Adam that [canny.io](http://canny.io)’s new non-third-party-cookie authentication support was being implemented…

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [August 24, 2020, 3:21pm UTC](https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019/5 "2020-08-24T15:21:59Z")

</div>

Have you tried `myPage/:paramOne/:paramTwo`?

---

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [August 24, 2020, 4:06pm UTC](https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019/6 "2020-08-24T16:06:06Z")

</div>

> [@cmallonee](#):
>
> Have you tried `myPage/:paramOne/:paramTwo` ?

That works for multiple parameters, but I am looking for a Dictionary parameter

i.e. I want to reach params.TEST.Val1 and params.TEST.Val2

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/3/933853fc20ddd4a58a2f82eee76767aaab5b5e1a.png)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [August 24, 2020, 4:22pm UTC](https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019/7 "2020-08-24T16:22:23Z")

</div>

Oh. Short answer: no, because the url is just a String. You could string-ify your object for passing through the url, and then expect a string for the param, with a separate custom object which converts it into an object through a binding transform. OR you could have basic value params, and then bind a custom object’s internal values to the view params.

---

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [August 24, 2020, 5:52pm UTC](https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019/8 "2020-08-24T17:52:28Z")

</div>

> [@cmallonee](#):
>
> with a separate custom object which converts it into an object through a binding transform

This is what I did as a workaround for now, and I have a script that converts the `/Val1=1&Val2=3` format into a dictionary on a custom property.

It just didnt feel like the most scalable way for the future, especially considering you can have Object parameters, it would be nice to be able to utilize those through the URL in some format as well (same with list, but in the meanwhile you could probably do that with /1,2,3,4 parsing into [1,2,3,4])

For prosperities sake though, here is the Ideas post for anyone that runs into this same question

> **[Ability to pass dictionary parameters to a URL | Ignition Features and Ideas...](https://ideas.inductiveautomation.com/ignition-features-and-ideas/p/ability-to-pass-dictionary-parameters-to-a-url)**
>
> Most other environments that take URL parameters allow the format of ?Val1=2&Val2=3 to count as a dictionary being passed to the webpage.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [August 24, 2020, 5:59pm UTC](https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019/9 "2020-08-24T17:59:05Z")

</div>

Anything passed through the URL can ONLY be a string. If you absolutely MUST pass something like a dictionary, you’re better off using a Session Property and binding the relevant View values to that.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 25, 2020, 12:34am UTC](https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019/10 "2020-08-25T00:34:10Z")

</div>

Perspective’s parameter model is built only on the URL path, where parts of the path are substitutions. Is there any possibility of exposing the page’s actual query parameters from the underlying request object? Yeah, I know it is probably complicated by WebSockets, but…

(Haven’t dug under the hood to figure it out myself–too freaking busy.)

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [August 25, 2020, 3:13pm UTC](https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019/11 "2020-08-25T15:13:02Z")

</div>

Cody’s answer is correct - because pages are defined by their URL, and URLs are just strings, at some point, it’s got to be a string. Even if we were to support some sort of ?param=val style parameter passing, all this would do is open up a page to accepting variable numbers of params, not actual dictionary objects, because again, it’s just a string.

Also, the URLs are mostly a fiction because Perspective is a single-page-app. Beyond the initial http request, there are no more requests from there on out - as you navigate, we just manipulate the URL for you so it looks like you’re navigating in the traditional sense. But the intent of the model is that as you navigate around your pages, the URL is bookmarkable - if you _were_ to land on that URL, it would bring you back to the same place in the app.

You could avoid this by simply eschewing the mounted page system entirely, and just manipulate mounted views & their parameters directly. The downside is that you’d lose the bookmark-ability of navigation and to a user, the app would appear to be all one un-changing URL.

---

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [August 25, 2020, 4:05pm UTC](https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019/12 "2020-08-25T16:05:57Z")

</div>

I appreciate the clarifications!

I ended up going the route of encoding the URLs in a way that i can decode back into a dictionary for this use case.

For anyone that wants the scripts here they are

```auto
# This takes a dictionary of parameters and converts it into a URL parameter string
def dictionaryToURLParameter(params):
	import urllib
	paramList = []
	for key, value in params.items():
		 try: key = urllib.quote(key)
		 except: key = key
		 try: value = urllib.quote(value)
		 except: value = value
		 paramList.append("%s=%s" % (key, value))
	
    # Replace any slashes with pipes so that the perspective URL parser doesnt fail to understand the text
	return "&".join(paramList).replace('/', '|')

# This takes a URL parameter string and converts it into a dictionary of parameters
def URLStringToDictionary(paramString):
	import urllib
    # Replace any pipes with slashes so that the perspective URL parser doesnt fail to understand the text
	paramString = urllib.unquote(paramString.replace('|', '/'))
	params = {}
	for pair in paramString.split('&'):
		pair = pair.split('=')
		params[pair[0]] = pair[1]
	return params

```

---

<div class="post-metadata">

**Author:** ![victor1](https://avatars.discourse-cdn.com/v4/letter/v/6de8d8/32.png) [@victor1](https://forum.inductiveautomation.com/u/victor1)\
**Post date:** [September 9, 2020, 6:54pm UTC](https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019/13 "2020-09-09T18:54:56Z")

</div>

I need to get the parameters with the format ‘?code=xxx&scope=yyy’.

I’m trying to use Google OAuth for the Google Drive API and the redirect\_uri passes the parameters according to the format above.

When I tried `myPage/:param`, Ignition was unable to get the parameters due to the ‘?’ Character.

How can I get the ‘code’ and ‘scope’ parameters?

---

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [September 9, 2020, 7:54pm UTC](https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019/14 "2020-09-09T19:54:34Z")

</div>

Are you able to preface the Google parameter with a `/` instead of a `?`, if so then you could take the string and extract it into a dictionary

Perspective doesn’t know to count the `?` as a delimiter in the URL

---

<div class="post-metadata">

**Author:** ![victor1](https://avatars.discourse-cdn.com/v4/letter/v/6de8d8/32.png) [@victor1](https://forum.inductiveautomation.com/u/victor1)\
**Post date:** [September 9, 2020, 8:13pm UTC](https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019/15 "2020-09-09T20:13:58Z")

</div>

No. The Google OAuth API automatically sends with `?`

---

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [September 9, 2020, 9:21pm UTC](https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019/16 "2020-09-09T21:21:24Z")

</div>

In the entry field where it asks for a callback URL, could you enter it with the default `/` at the end like so:  
`ignition.com/data/client/perspective/MyProject/`

that way it ends up as `ignition.com/data/client/perspective/MyProject/?code=xxx&scope=yyy`

---

<div class="post-metadata">

**Author:** ![victor1](https://avatars.discourse-cdn.com/v4/letter/v/6de8d8/32.png) [@victor1](https://forum.inductiveautomation.com/u/victor1)\
**Post date:** [September 10, 2020, 10:55am UTC](https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019/17 "2020-09-10T10:55:00Z")

</div>

I tried that. But the ignition fails to get the parameters if there is a `?`

I binded a label’s text property with `:/code` to test it

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/2/6287005bc00bdf8c90878f5f3c26141cd9964398.png)

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/b/aba1db2d8e0426fc83fe8fcf9c3c46c4464e951d.png)

---

<div class="post-metadata">

**Author:** ![victor1](https://avatars.discourse-cdn.com/v4/letter/v/6de8d8/32.png) [@victor1](https://forum.inductiveautomation.com/u/victor1)\
**Post date:** [September 10, 2020, 10:58am UTC](https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019/18 "2020-09-10T10:58:09Z")

</div>

As a workaround, I created a PHP page that receives these query parameters and returns to ignition as route parameters.

But I can’t believe this is the best approach

---

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [September 10, 2020, 2:46pm UTC](https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019/19 "2020-09-10T14:46:05Z")

</div>

> [@victor1](#):
>
> I binded a label’s text property with `:/code` to test it

A few notes,

1. Defining the url parameter should have the colon after the slash like `/page/:code`
2. You shouldn’t have to bind the label text to anything similar to `/:code` because that url parameter translates to `view.params.code` which is where you should be binding it
3. It’s weird to see your label acting the way it is, because I use question marks in my parameters and it doesn’t care, let me know if anything above fixes it

---

<div class="post-metadata">

**Author:** ![victor1](https://avatars.discourse-cdn.com/v4/letter/v/6de8d8/32.png) [@victor1](https://forum.inductiveautomation.com/u/victor1)\
**Post date:** [September 10, 2020, 2:50pm UTC](https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019/20 "2020-09-10T14:50:21Z")

</div>

Sorry, I typed wrong.

I did as you described in 1 and 2

[Next page](https://forum.inductiveautomation.com/t/perspective-url-dictionary-parameter/38019.md?page=2)
