如何将Copyleaks删除API调用?

发布于 2025-01-27 08:26:19 字数 675 浏览 2 评论 0原文

我一直在尝试删除使用API​​进行的某些扫描。现在,当我尝试使用此处提供的文档来执行此操作时: https://api.copyleaks .com/documation/v3/ducuntion/delete ,我一直遇到以下错误,即:b'{“ scans”:[“扫描字段是必需的。”,“不能为null”] }'

我正在关注API的文档以创建我的JSON对象并将其传递给request.patch,但我会遇到相同的错误。

只是为了确保我没有错误地这样做,这是我的代码:

myobj = json.dumps({'scans':[{'id':'43973'}],'purge':'false'})


response = requests.patch('https://api.copyleaks.com/v3.1/education/delete', headers=headers, data=myobj)

如果有人可以为此提供一些指导,那真的很好。

I have been trying to delete certain scans I have made using the API. Now, when I try to do that using documentation provided here : https://api.copyleaks.com/documentation/v3/education/delete, I keep getting the following error which is :b'{"scans":["The scans field is required.","Cannot be null"]}'

I am following the documentation for the API to create my json object and pass it to request.patch but I keep getting the same error.

Just to be sure I am not doing this incorrectly, here is my code :

myobj = json.dumps({'scans':[{'id':'43973'}],'purge':'false'})


response = requests.patch('https://api.copyleaks.com/v3.1/education/delete', headers=headers, data=myobj)

If someone could provide some guidance with regards to this, it would be really nice.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

千鲤 2025-02-03 08:26:19

确保将内容类型标头设置为应用程序/JSON,例如:

'content-type':'application/json',

编辑:

标题对象应该看起来像这样:

headers = {
'Content-type': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'

}

make sure you set the content type header to application/json like so:

'Content-type': 'application/json',

EDIT:

the headers object should look like this:

headers = {
'Content-type': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'

}

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文