Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when creating attachment #125

Open
JesperNJessen opened this issue Jul 9, 2018 · 1 comment
Open

Error when creating attachment #125

JesperNJessen opened this issue Jul 9, 2018 · 1 comment

Comments

@JesperNJessen
Copy link

JesperNJessen commented Jul 9, 2018

I'm getting an error when I try to use the AttachmentsResource.UploadAsync method.

Error message is "Status code retrieved was 422 and not a 201 as expected".

My code:

var zendeskOptions = new ZendeskOptions
{
    EndpointUri = "https://{mycompany}.zendesk.com",
    Username = "{myemail]",
    Token = "{mytoken}"
};

var zendeskOptionsWrapper = new OptionsWrapper<ZendeskOptions>(zendeskOptions);
var client = new ZendeskApiClient(zendeskOptionsWrapper);

_attachmentsResource = new AttachmentsResource(client, NullLogger.Instance);

...


var byteArray = System.IO.File.ReadAllBytes(filename);
var stream = new MemoryStream(byteArray);

var upload = await _attachmentsResource.UploadAsync(shortfilename, stream); //this line fails

Is there something I'm missing?
I went through the tests, but it looks to me like I'm doing the exact same thing.

NuGet package version installed is "3.1.0-alpha-374"

@mikerogers123 mikerogers123 added this to To do in General maintenance via automation Jun 30, 2022
@mikerogers123
Copy link
Contributor

Hi @JesperNJessen, I have added a TODO card to look into this. Our team will prioritise this as part of our usual work flow, can't promise when we will get round to it. In the meantime please do let me know if this is still an issue for you - I am conscious the issue is 4 years old.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants