使用PowerShell使用REST API调用的限制

发布于 2025-02-10 11:39:27 字数 594 浏览 1 评论 0原文

我需要使用PowerShell通过REST API调用进行一些历史数据。我被数据量超过4 GB的终点之一所困。当我在PowerShell ISE中运行PowerShell脚本时,它可以按预期运行。但是,当我通过SQL Server Integration Services执行进程任务时,将无法下载JSON有效负载。

有更好的方法解决这个问题吗?是否应该注意任何限制?

$Header = @{
    "authorization" = "Bearer $token"
}
#make REST API call
$Parameters = @{
    Method      = "GET"
    Uri         = "https://api.mysite.com/v1/data"
    Headers     = $Header
    ContentType = "application/json"
    Body        = $BodyJson
}
Invoke-RestMethod @Parameters

错误: system.outofmemoryexception

I have a need to make a few historical data pulls via REST API call using Powershell. I'm stuck with one of the endpoints where the data volume is over 4 GB. When I run the Powershell script in the Powershell ISE it works as expected. But, When I run the same via SQL Server Integration Services Execute Process Task it's not able to download the JSON payload.

Is there a better way to tackle this? Are there any limitations one should be mindful of?

$Header = @{
    "authorization" = "Bearer $token"
}
#make REST API call
$Parameters = @{
    Method      = "GET"
    Uri         = "https://api.mysite.com/v1/data"
    Headers     = $Header
    ContentType = "application/json"
    Body        = $BodyJson
}
Invoke-RestMethod @Parameters

Error: System.OutOfMemoryException

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文