Skip to main content
Participant
June 10, 2022
Question

Sign API: ETag collected at agreement creation and used right after don't match. Can't add field

  • June 10, 2022
  • 0 replies
  • 327 views

I'm trying to create an agreement from a plain pdf, and adding a signature field before sending it. So I attempt to:

  • upload a transient document
  • using the transient document id, create an agrrement in draft state
  • using the agreement id, and etag collected from the http headers, try to add a signature field

I'm succesful in the first two steps, but the third step always ends up with an http error 412: RESOURCE_MODIFIED. Since I'm not doing anything between the agreement creation and adding the signature field, it stands to reason that I'm somehow using the ETag header and if-match field wrong, but I can't figure out what is the problem.

I'm using the C# SDK. This is a sample of what I'm doing:

var agreementsApi = new AgreementsApi(baseURI);
var agreementInfo = new AgreementCreationInfo();

// Assume we add the appropiate fields to agreementInfo. That part is working
agreementInfo.SignatureType = AgreementCreationInfo.SignatureTypeEnum.ESIGN;
agreementInfo.State = AgreementCreationInfo.StateEnum.DRAFT;

ApiResponse<AgreementCreationResponse> result = agreementsApi.CreateAgreementWithHttpInfo(authorization, agreementInfo);

string agreementId = result.Data.Id;
string eTagAgreement = result.Headers["ETag"];

var location = new FormFieldLocation { Height = 5, Left = 5, PageNumber = 2, Top = 10, Width = 10 };
var listLocations = new List<FormFieldLocation>();
listLocations.Add(location);

var newFormField = new FormField { Locations = listLocations, Name = "firma" };
var formFieldList = new List<FormField>();
formFieldList.Add(newFormField);

var newFormFieldInfo = new FormFieldPutInfo(formFieldList);

agreementsApi.UpdateFormFields(authorization, eTagAgreement, agreementId, newFormFieldInfo);
    This topic has been closed for replies.