Skip to main content

I’m trying to use the .NET SDK to create a signature request for a file. My code is:



public async Task<BoxSignRequest> CreateSignatureRequest(BoxUser user, string signerEmail, string emailMessage, string subject, string sourceFileId, string destinationFolderId)

{

var userClient = GetUserClient(user); //this uses the Client Credentials Grant to get a token for the user that owns the file

BoxSignRequestCreateRequest createRequest = new BoxSignRequestCreateRequest()

{

AreRemindersEnabled = true,

AreTextSignaturesEnabled = false,

DaysValid = 10,

EmailMessage = emailMessage,

EmailSubject = subject,

ParentFolder = new BoxRequestEntity()

{

Id = destinationFolderId

},

Signers = new List<BoxSignRequestSignerCreate>() {

new BoxSignRequestSignerCreate()

{

Email = signerEmail,

LoginRequired = true,

Role = BoxSignRequestSignerRole.signer

}

},

SourceFiles = new List<BoxSignRequestCreateSourceFile>()

{

new BoxSignRequestCreateSourceFile()

{

Id= sourceFileId

}

}

};



var signRequest = await userClient.SignRequestsManager.CreateSignRequestAsync(createRequest);

return signRequest;

}



I’m getting a Bad Request error. The documentation on the .NET SDK is not very comprehensive so I’m wondering if anyone else can help me out here.


Thanks!

Hi,


do you have Manage signature requests scope enabled in your developer console ?


Can you share a full error message ?





Best,


Lukasz


Yes I have manage signature requests scoped in my CCG app.



I can’t provide a full error message because my debugger stops when the box client sends the request to the box api, it just returns Bad Request without any detail as to what part of the sign request isn’t well-formed, etc.


Can you share a request_id?


Hi @eparshall,



The reason you’re receiving a 400 Bad Request is that the request sent by you in BoxRequestEntity object in the ParentFolder’ property lacks the required Type property, which is necessary for SignRequest in this case.



All you need to do is replace:



ParentFolder = new BoxRequestEntity()

{

Id = destinationFolderId

}



with:



ParentFolder = new BoxRequestEntity()

{

Id = destinationFolderId

Type = BoxType.folder

}



I hope this helped!


That was indeed the issue, thank you.


This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.


Reply