Skip to content

422 Unprocessable Entity error uploading attachment #552

Answered by mozts2005
kswygert asked this question in Q&A
Discussion options

You must be logged in to vote

You are missing a few things like the data and the file name should be just the name you want in zendesk not the path.

[Test]
public void CanUploadAttachments()
{
var res = Api.Attachments.UploadAttachment(new ZenFile()
{
ContentType = "text/plain",
FileName = "testupload.txt",
FileData = File.ReadAllBytes(Path.Combine(TestContext.CurrentContext.TestDirectory, "testupload.txt"))
});
Assert.That(!string.IsNullOrEmpty(res.Token), Is.True);
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kswygert
Comment options

Answer selected by kswygert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants