user14133716
user14133716

Reputation: 17

Azure Logic Apps - how to do text options on variables?

I'm creating a Microsoft Azure Logic App which I'm working with Microsoft GraphAPI.

The data I get back from GraphAPI is paginated, so I need to retrieve the odata.nextlink and then visit the nextlink via a HTTP Get request. As I'm using a Custom Connector for the logic app, I need to pass in the $skiptoken value, so need a way to create a variable with that value.

The odata.nextlink is in the format below.

https://graph.microsoft.com/beta/users?$skiptoken=X%2744537074020001000000143A546573743137304063726F6D70746F2E636F6D29557365725F64626366343261612D383933372D343166322D613963642D376661306265326335646361B900000000000000000000%27

I can't find a way to create a variable for just the value of the $skiptoken. I'm able to extract the value "$skiptoken=X&2745370740.....0%27" into a variable (using uriQuery), but can't see a way to get just the value of the $skiptoken (e.g. the X&2745370740.....0%27" value) into a variable.

Any ideas?

Upvotes: 0

Views: 805

Answers (1)

Robert Dyjas
Robert Dyjas

Reputation: 5217

I can think about two simple ways to extract the token. The answer below is tested in Power Automate, but should work in Logic App.

For both cases, let's assume that extracted token value can be accessed via:

outputs('Compose')

Split() function

In that case you split the string into array - the second element will be your token, so you extract it using last():

last(split(outputs('Compose'),'$skiptoken='))

Replace() function

You can also replace the beginning of the string with empty string:

replace(outputs('Compose'),'$skiptoken=','')

If your extracted string might have additional params, you might extract them using another Split() function - in that case you'll probably split by & - the character, which connects uriQuery parameter.

Upvotes: 1

Related Questions