Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
RESTAPI GET-调用REST方法和浏览器的区别_Rest_Powershell - Fatal编程技术网

RESTAPI GET-调用REST方法和浏览器的区别

RESTAPI GET-调用REST方法和浏览器的区别,rest,powershell,Rest,Powershell,在使用RESTAPI时,我遇到了这样一个问题:在powershell中,使用-Method GET调用RestMethod返回的值与浏览器中完全相同的请求返回的值不同 从浏览器输出: @odata.count 3 value 0 Name "Administrator" DisplayName "Administrator" Groups IsStatic true Id 3 1 Name "awesomeRole" DisplayName "aw

在使用RESTAPI时,我遇到了这样一个问题:在powershell中,使用-Method GET调用RestMethod返回的值与浏览器中完全相同的请求返回的值不同

从浏览器输出:

@odata.count    3
value   
0   
Name    "Administrator"
DisplayName "Administrator"
Groups  
IsStatic    true
Id  3
1   
Name    "awesomeRole"
DisplayName "awesomeRole"
Groups  
IsStatic    false
Id  5
2   
Name    "Robot"
DisplayName "Robot"
Groups  
IsStatic    true
Id  4`
powershell的输出:

Name        : Administrator
DisplayName : Administrator
Groups      : 
IsStatic    : True
Id          : 1
Name        : Robot
DisplayName : Robot
Groups      : 
IsStatic    : True
Id          : 2`

这怎么可能呢?

嗨!您可能需要在问题中添加更多详细信息,以便我们能更好地帮助您。我用收到的输出编辑了文章。@Frederigo使用类似Fiddler的工具检查您的两个客户端发出的请求并进行比较。请求之间显然存在一些差异。请求在两种情况下都是相同的:https://{address}/odata/$metadata#角色