Signing

Get a reference to a document in Signicat Archive

439 views June 30, 2017 October 9, 2017 1

Using C#
[TestMethod]
public void Use_the_getStatus_method_to_find_the_location_of_the_archived_documents()
{
    // RequestID for a completed order with sendresulttoarchive = true
    string requestId = "";
    taskstatusinfo response;
    using (var client = new DocumentEndPointClient())
    {
        response = client.getStatus(new getstatusrequest
        {
            service = "demo",
            password = "Bond007",
            requestid = new string[] { requestId }
        })[0];
    }
    Assert.IsNotNull(response.documentstatus[0].resulturi);
    Assert.IsTrue(response.documentstatus[0].resulturi.Contains("/archive/"));
}

private async Task<sdsdocument> UploadDocument()
{
    var httpClientHandler = new HttpClientHandler { Credentials = new NetworkCredential("demo", "Bond007") };
    using (var client = new HttpClient(httpClientHandler))
    {
        HttpContent content = new ByteArrayContent(File.ReadAllBytes("demo_avtale.pdf"));
        content.Headers.ContentType = new MediaTypeHeaderValue("application/pdf");
        HttpResponseMessage response = await client.PostAsync("https://preprod.signicat.com/doc/demo/sds", content);
        string documentId = await response.Content.ReadAsStringAsync();
        return new sdsdocument
        {
            id = "doc_1",
            refsdsid = documentId,
            description = "Terms and conditions"
        };
    }
}

private subject GetSubject()
{
    return new subject
    {
        id = "subj_1", // Any identifier you'd like
        nationalid = "1909740939" // CPR, personnummer, fødselsnummer etc.
    };
}
private createrequestrequest GetCreateRequest(sdsdocument documentInSds)
{
    var request = new createrequestrequest
    {
        password = "Bond007",
        service = "demo",
        request = new request[]
         {
             new request
             {
                 clientreference = "cliref1",
                 language = "da",
                 profile = "demo",
                 document = new document[]
                 {
                     documentInSds
                 },
                 task = new task[]
                 {
                     new task
                     {
                         id = "task_1", // Any identifier you'd like
                         subjectref = "subj_1", // Any identifier you'd like
                         documentaction = new documentaction[]
                         {
                              new documentaction
                              {
                                  type = documentactiontype.sign, // Sign or View
                                  documentref = "doc_1" // Any identifier you'd like
                              }
                         },
                         signature = new signature[]
                         {
                             new signature
                             {
                                 method = new string[]
                                 {
                                     // The name of the signature method(s)
                                     "nemid-sign"
                                 }
                             }
                         }
                     }
                 }
             }
         }
    };
    return request;
}

Was this helpful?