New Relic One application read data from URL

Hi all,

I am creating a custom New Relic one application leveraging the platform New Relic has provided to create custom ReactJS apps to be deployed in the Apps section on New Relic one.
I have a use case in which I need to read the query parameters.
For example: If I have a URL like below[timeRange][duration]=3600000&platform[$isFallbackTimeRange]=false&myQueryParam=My_QUERY_DATA
I have a use case in which I need to read the myQueryParam to show data accordingly in the application. This is a use case in which we directly want to query some particular information directly via information from the URL when we redirect to this application from some external website.
I tried using the ReactJS properties like props.location, but they do not work as the application is deployed inside a frame and does not have access to the URL directly(?). We can read properties like timerange via PlatformStateContext. I was wondering is there a way to modify the PlatformState class to get custom data from it.
Thank you

@Kartik.mittal Been awhile and so far no responses from the community on this. Wondering how your customization is going so far? Going to also tag @mfrederick and @jworrall to see if they have any insights to share.

@Kartik.mittal We do indeed have a way to do this!

It’s called nerdlet.setUrlState and you can read more about it in our developer docs -

It takes the info and encodes it into the url, just not as the typical queryParams, but instead as a base64 encoded object.

When you want to pull it out and use it in your app you can use the NerdletStateContext consumer, there’s an example in the docs

For more examples, many of our nr1 apps in open source take advantage of this to store state in the url, I did a search on Github like this .

nr1-network-telemetry uses it to store a user’s last selected accountId and nr1-graphiql-notebook uses it store which Notebook you’re on.

Hope this helps!