18
Views
5
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 



Rank: #64
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') ?

Rank: #64

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

Rank: #2936

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

Rank: #64
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') ?

Rank: #2936

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

Rank: #64

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