220
Views
6
Comments
Solved
Rest API Parameters
Application Type
Traditional Web
Service Studio Version
11.9.2 (Build 34232)

I have a Rest API to MSGraph which works fine when i 'test' it the rest method in service studio, however when i run it it errors as 400 Bad request.  I've debugged it and right up to the end of 'onbeforerequest' and its fine but then it errors when it hits the call.  The api is :  

https://graph.microsoft.com/v1.0/groups$filter=startsWith(displayName,'{name}')&$expand=owners&$select=id,displayName

I've tried truncating the API and using  just https://graph.microsoft.com/v1.0/groups$filter=startsWith(displayName,'{name}') incase it was due to the 'expand' parameter.  I've also tried replacing $filter= with a parameter incase it wasn't liking the special characters, but no luck.


Any advice of what the issue might be or how i can investigate the error further?


Thanks 



2018-10-29 08-31-03
João Marques
 
MVP
Solution

Can you try having the web service defined like this:


https://graph.microsoft.com/v1.0/groups?$filter={FilterParameter}&$expand=owners&$select=id,displayName


and have the FilterParameter value = startswith(displayName, 'Name') ?

2018-10-29 08-31-03
João Marques
 
MVP

Hi LizT,


Looking at the first glance, I'd say you are missing a ? after groups.

Here's an example of a call I did successfully to this service:

https://graph.microsoft.com/v1.0/groups?$select=id,displayName,resourceProvisioningOptions&$filter=displayName eq 'group'


Can you try with the question mark after groups?


Regards,
João

2018-02-12 15-49-34
LizT

Hi Joao.  I’ve added it now but i still get the same result  400 bad request

2018-10-29 08-31-03
João Marques
 
MVP
Solution

Can you try having the web service defined like this:


https://graph.microsoft.com/v1.0/groups?$filter={FilterParameter}&$expand=owners&$select=id,displayName


and have the FilterParameter value = startswith(displayName, 'Name') ?

2018-02-12 15-49-34
LizT

That’s worked!  Do you know what the issue was?  I had tried replacing the $filter part with an input parameter before but that had failed, but I hadn’t thought to replace this Section.

Thanks so much for your help

2018-10-29 08-31-03
João Marques
 
MVP

Hi LizT,


I'm glad it worked!

In my project, I pass the whole thing as a parameter and it worked so I figured it was the same with your situation.

Since these values are passed in URL they might be messing up by not being encoding, probably the parenthesis and the quotes, whereas when you pass via parameter they automatically are.


Regards,

João

2019-07-22 18-21-35
Maroan Morales

Hello, I have seen what was presented in this post, I wanted to consult this case, I have an API where I have 2 parameters and in one of them I need to concatenate more than one value, example

getAPIDataDetails?planning=C001&FLOC=SH0000013

this would be to query for a value, but if I need more values for other Flocs I should add more:

getAPIDataDetails?Planning=C001&FLOC=SH0000013&FLOC=SH0000014&FLOC=SH0000015&FLOC=SH0000016&FLOC=TR0000080&FLOC=TR0000093&FLOC=TR0000094

I have done exactly what is in the post, getAPIDataDetails?planning={param1}&FLOC={param2}

in my flow if I need to add more data to param2 I just concatenate values to it

FLOCs + If(Length(FLOCs)=0, "","&FLOC=") + FlocsDetail

leaving the variable FLOCs

"SH0000013&FLOC=SH0000014&FLOC=SH0000015&FLOC=SH0000016&FLOC=TR0000080&FLOC=TR0000093&FLOC=TR0000094"


but this only brings me the value of the first floc -> SH0000013, any suggestions????


ServiceStudio_ti3qxkaQfE.gif
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.