Unable to upload document for verification

(Janakiram Angara) #1

Hi, As i am trying to upload documents for verification to ‘/documents’ end point, I am getting response as
“code”: “InvalidResourceState”,
“message”: “Resource cannot be modified.”
I am sending access_token and all required headers as described in dwolla documents page.

the C# code for upload is mentioned below, please advise me.
HttpContent fileStreamContent = new StreamContent(stream);

            using (var client = new HttpClient())
            using (var formData = new MultipartFormDataContent())
                Uri uploadUrlUri = new Uri(dwollaCustomerUri + "/documents");
                client.DefaultRequestHeaders.Add("Authorization", "Bearer " + accessToken);
                client.DefaultRequestHeaders.Add("Accept", "application/vnd.dwolla.v1.hal+json");
                client.DefaultRequestHeaders.Add("Cache-Control", "no-cache");
                client.DefaultRequestHeaders.Add("ContentType", "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW");

                formData.Add(new StringContent("idCard"), "documentType");//Hard coded for testing purpose.
                formData.Add(fileStreamContent, "file", blobName);

                var response = client.PostAsync(uploadUrlUri, formData).Result;

                return response;

(Stephen Ausman) #2

Hey @janakiram,

It sounds like the customer you are trying to upload a document for is currently not in the "document" state. When you do a GET /customers/:id the customer should have:

"status": "document"

before you are able to upload documents for them.