cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Remove quotations marks from string into http request

Hello,

 

I'm trying to insert a string into a json body http request, but quotations marks stop me from creating a valid request.

 

I'm creating a string with email from an Azure AD group, with that syntax : 

 

{"email":"email1"},   >> repeated for each user in the group 

 
 

but when i'm inserting this string into my body, it turns out like this : 

"{\"email\":\"email1\"},{\"email\":\"email2\"}"
flow1.jpgflow2.jpgflow3.jpg
Obviously this won't work, how can I manage to have only what I entered in my string? no slash or quotations marks added. 
 
For informations, it's targeting an API from Adobe Sign, because his nativ connectors can't do a lot of things (like masque or group)
 
Thanks for your help
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User
Dual Super User

Re: Remove quotations marks from string into http request

@AntoineT 

Not sure we are understanding each other

I thought you were already getting target emails, and you just have a format problem injecting thte info in your json. Actually, whare are you getting email address from the screenshots you initially shared? Not from Azure AD connector?

Flow_antoine.jpg

 

Now, I do not have experience working with Azure AD connector, but according to its official documentation:

-Get group members action block response is an array of Get user response

-Get user response includes a property called Mail and tons of other Properties

Assuming this, if you iterate in your 'Apply to Each' through 'Get group members response', you should be able to inyect Mail related info to the array you are building by means of:

setProperty(json('{}'),'email',item()?['Mail'])

I haven't used this connector in my life, so if this last suggestion from my side makes the magic, it means both of us are incredibly lucky

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

12 REPLIES 12
Highlighted
Dual Super User
Dual Super User

Re: Remove quotations marks from string into http request

Hi
Let's see if I understood your flow:
-grupMember1 is an array variable, right?
You are iterating through another array called 'Membre du g...' by means of an Apply to each, right?
- inside your Apply to each, you are invoking 'Append to array variable' so you append 'Membre du g..' -can you share a screenshot of its content?- to groupMember1 inside {}.
-the API you are about to invoke expects an array of objects instead of an array of strings
If all my assumptio s are correct, I would suggest to replace current expression from your 'Append to array' and use this function instead by clicking 'Add dynamic content' and then 'Expression'
json()
Once added you shall add inside the json parenthesis, the dynamic content 'Membres du g..' you are currently inserting
Hope this helps


Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
Frequent Visitor

Re: Remove quotations marks from string into http request

Hello and thanks for the answer, i've switch Flow in english for the screenshots : 

 

- groupMember1 is a String initialize nothing.

image.png

 

This string contains every email of the members of a specific AD Group which looks like this

image.png

(Append to a string variable)

 

i'm then creating another variable called groupMemberOK (still a string) which is groupMember1 less the last coma (not needed in the json api), value of this groupMemberOK :

image.png

image.png

 

Should I've been using array instead of a string? in that case, how do you remove the last char of an array? substring won't work I suppose

 

The API i'm calling just require a JSON Body (Adobe Sign) ; I need my API to look like this 

 

 

 

"memberInfos": [
        {
          "email": "perso@antoine-tal.com"
        },
        {
          "email": "anothermail@antoine-tal.com"
        }
      ],

 

 

 

 

 With what i'm currently doing, the strings turns into : 

 

image.png

 

I'm not sure where you suggested I tried the json() expression, however I tried to insert a dynamic content into my http request's json body with >>   json(variables('groupMemberOK')) and it indeed works but I only got the first mail, other don't appear. 

 

 

I tried to be as clear as possible but don't hesitate if I wasn't clear enough in some parts 

 

Thanks again !

Highlighted
Frequent Visitor

Re: Remove quotations marks from string into http request

Hello and thanks for the answer, 

 

I'll try to be as clear as possible but if some part are still cloudy don't hesitate.

 

I have a string variable called groupMember1 

image.png

 

I'm getting with an Azure AD connectors every mail's user of a specific group AD (group test so seeing the ID doesn't matter)

 

I then with an apply to each, insert in my variable the "setup" that I want in my http call.

 

image.png

 

As you can see I add a coma at the end, in case their is multiple account in the AD group. However the json body for the http request dont want a coma at the end, therefore I remove it and insert the result in a string variable called groupMemberOK

 

image.png

 

The content is then something like that : 

 

image.png

 

I then add this variable to my json body 

 

image.png

 

On this screen I tried to insert my variable with the expression   json(variables('groupMemberOK')) ; while it was in the good format, it only gave me the first mail and not the second.

 

And if I insert in the body directly the string expression, it turns out like this : 

 

image.png

 

I just want my json body to be like this 

 

"memberInfos": [
        {
          "email": "first@mail.com"
        },
        {
          "email": "second@mail.com"
        }
      ],

 

Should i've been using array instead of string? if so how do you remove the last char of en array (the coma) ?

 

Thanks again

Highlighted
Dual Super User
Dual Super User

Re: Remove quotations marks from string into http request

Hi
Sorry I am not in front of my laptop, I cannot send you screenshots
In my opinion, the problem is you are building objects as if they were strings, that's why you see \\ in front of your double quotes.
I would try this:
- change groupMember variable type: from 'string' to 'array'. This way you will not have problems with the extra comma
- replace 'Append to string variable' inside your Apply to each, use 'Append to Array variable' instead
Inside 'Append to Array variable' use the following expression:
setProperty(json('{}'),'email',<insert here the dynamic content that currently stores the email address>)

Then after the 'apply to each' insert a dummy Compose action block, add it as input your array variable, execute the flow and inspect its content.
You will see its content now is
[{"email": "a@a.fr"},...
{"email": "z@z.fr"}]
So, you can inject your array variable as the value of property "memberInfos" in your JSON, no need to add/remove special characters
Hope this helps


Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
Frequent Visitor

Re: Remove quotations marks from string into http request

No worries ! Again thanks for the taking the time. 

 

I understand what you're trying to do, however how can I get the mail of the azure AD group?

 

In the apply to each, when trying to append to the array variable, I only see body & member on the Azure AD Dynamics Content. 

 

image.png

 

I tried with this 2, body returns everything, and with Group Members I tried 

setProperty(json('{}'),'email',body('Obtenir_les_membres_du_groupe')?['email'])

(and same with mail instead of email)

 

but it returns "email = null" 

 

I guess there is a way to limit the body in only returning the wanted mail? 

Highlighted
Dual Super User
Dual Super User

Re: Remove quotations marks from string into http request


@AntoineT wrote:

No worries ! Again thanks for the taking the time. 

 

I understand what you're trying to do, however how can I get the mail of the azure AD group?

 

Hi again!

I thought you were already getting email addresses...

So next question is... Are you currently using Azure Active directory API or Microsoft Graph?

https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-graph-api



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
Frequent Visitor

Re: Remove quotations marks from string into http request

My bad then! I'm using the "Azure AD" connector directly integrad in flow.

 

image.png

 

Which allow me to later insert in a string the email I need

 

image.png

Highlighted
Dual Super User
Dual Super User

Re: Remove quotations marks from string into http request

Hi again
So when you invoke Get group members, the outputs are the ones from your screenshot, and the property you want to read is 'Group Members Mail', right?
The 'Apply to each' you are currently doing is taking as its input an array (i.e. list) of 'Group ids' you are interested in, right?
If so, you just need to add inside the 'apply to each' the action 'Get group members' to access email address, and then 'append to array variable'
Hope this helps


Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
Frequent Visitor

Re: Remove quotations marks from string into http request

Hello! 

 

When I invoke group members, I indeed want to read 'Group Members Mail' but, if using Dynamic content in an empty variable, I have everything as seen here : 

 

image.png

 

But when I insert as an expression 

setProperty(json('{}'),'email',<insert here>)

I'm only getting 2 outputs, as seen here : 

image.png

 

 
 
The 'Apply to each' is taking as its input Group Members directly, I only have one Azure AD Group, there will never be multiple, only a random number of people in it. 
So it takes as input the group members i'm interested in. 
 
Can't try that since the input is already group members.
 
 
I'm sorry I'm not sure I fully understood the answer, so I tried to be as clear as possible !
 
Thanks for the help so far, really appreciated. 
Highlighted
Dual Super User
Dual Super User

Re: Remove quotations marks from string into http request

@AntoineT 

Not sure we are understanding each other

I thought you were already getting target emails, and you just have a format problem injecting thte info in your json. Actually, whare are you getting email address from the screenshots you initially shared? Not from Azure AD connector?

Flow_antoine.jpg

 

Now, I do not have experience working with Azure AD connector, but according to its official documentation:

-Get group members action block response is an array of Get user response

-Get user response includes a property called Mail and tons of other Properties

Assuming this, if you iterate in your 'Apply to Each' through 'Get group members response', you should be able to inyect Mail related info to the array you are building by means of:

setProperty(json('{}'),'email',item()?['Mail'])

I haven't used this connector in my life, so if this last suggestion from my side makes the magic, it means both of us are incredibly lucky

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

Highlighted
Frequent Visitor

Re: Remove quotations marks from string into http request

In the screenshot, those emails came from a String where I inserted mail from azure ad group in the 'Apply to each'... again, not sure how clear this was haha 

 

But but but ! Your solutions works! 

 

Indeed setProperty(json('{}'),'email',item()?['Mail'])works perfectly well, I just had to remove the [] from my json body but that's no problem. 

For information, this looks like the image below.

 

  

So in resume, how it works : 

 

- Getting group members by Azure Connectors with the group ID

- Apply to each through those group members, and append to an array variable : setProperty(json('{}'),'email',item()?['Mail'])- Compose this array variable

- Insert in the http request the Compose 

 

And woof, it's works ! 

 

I can't thanks you enough for taking so much time @efialttes, sorry we didn't understood each other right away ! 😁

 

 

 

 

image.png

 

 

 

Highlighted
Dual Super User
Dual Super User

Re: Remove quotations marks from string into http request

Hurray!

Well you already thanked me enough, since you marked my last answer as a valid solution and also clicked the 'Thumb up' icon in each of my answers. Thanks for your kindness!

Glad to help! Au revoir!

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Helpful resources

Announcements
firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (7,784)