我正在使用 this APIthis is my program

每当我尝试将粘贴发送到 pastebin 时,我都会在 API 的第 77 行收到错误消息:

return resp;

我不确定我应该怎么做才能使帖子成功发送。



任何帮助深表感谢。

最佳答案

您遇到的异常实际上在 return resp 之前就行了。

您应该在 PasteBinClient 的第 75 行放置一个断点并评估 resp 变量的内容。

根据 pastebin API documentation ,您应该收到一条消息,告诉您您的请求到底有什么问题:

Bad API request, invalid api_option
Bad API request, invalid api_dev_key
Bad API request, IP blocked
... etc

编辑:用户评论了确切的问题: invalid api_paste_format

在您的程序(第 31 行)中,您将“无”作为格式传递 - 您是否按照 API 文档的建议尝试过“文本”?

关于c# - pastebin API 错误 : Bad API request, 无效 api_paste_format,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24541582/

10-11 02:08