Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.

The entire process of storing reports is done within a session. That's why any reporting process begins with acquiring a session id.

Codeblock
languagec#
titleGetting a session id
linenumberstrue
public string GetSessionId(string filename, string ruleSet)
        {
            var client = new RestClient(this.serverUrl + this.reportSessionsUrl);
            var request = new RestRequest(Method.POST);
            request.AddHeader("content-type", "application/json");
            request.AddHeader("authorization", "Bearer " + this.token);



            request.AddParameter("application/json", "{\n\"DocumentName\": \"" + filename + "\",\n\"RuleSet\": \"" + ruleSet + "\"\n}", ParameterType.RequestBody);
            IRestResponse response = client.Execute(request);
            SessionIdObject id = JsonConvert.DeserializeObject<SessionIdObject>(response.Content);

            return id.SessionId;

        }


ParameterDescription
filenameThe name of the file that was checked.
ruleSetThe name of the rule set that was used to check the document.

The sample above uses a helper class that is being used as the result of the request. The code is shown below.

Codeblock
languagec#
linenumberstrue
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Congree
{
    public class SessionIdObject
    {
        public string SessionId { get; set; }

    }
}