4

I am using this API, and this is my program.

Whenever I try to send a paste to pastebin I get an error on line 77 in the API:

return resp;

I'm not sure what I should do to enable the post to send successfully.

A first chance exception of type 'PasteBin.PasteBinApiException' occurred in WinForms_Run.exe Additional information: Bad API request, invalid api_paste_format

Any help is much appreciated.

Grant Winney
  • 65,241
  • 13
  • 115
  • 165
Zed
  • 651
  • 1
  • 5
  • 25
  • A first chance exception of type 'PasteBin.PasteBinApiException' occurred in WinForms_Run.exe Additional information: Bad API request, invalid api_paste_format – Zed Jul 02 '14 at 21:50

1 Answers1

4

The exception you're encountering is actually on the line before return resp.

You should put a breakpoint on line 75 of PasteBinClient and evaluate the contents of the resp variable.

Based on the pastebin API documentation, you should get a message telling you exactly what's wrong with your request:

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

EDIT: User commented with exact issue: invalid api_paste_format.

In your program (line 31) you're passing in "None" as the format - have you tried "text", as suggested by the API docs?

Daniel May
  • 8,156
  • 1
  • 33
  • 43