Web Service: updateCOIRequest

Please note: CeRTNA will remove this web service on June 1, 2024. Please use the updateMOUCOIRequest web service in place of this one.

The updateCOIRequest web service is used to send an updated Certificate of Insurance (COI) document to CeRTNA. The COI document is linked to a specific submitter, so the correct Submitter ID must be provided when calling the web service.

As with other CeRTNA web services, you must use the login workflow to obtain a soft-token that can be used when calling the updateCOIRequest web service.

Click this link (Login Workflow Example) to review the Login workflow.

Your user credentials allow the backend web service to ensure that your user request is properly assigned to your organization.

Request Endpoint

Method URL
POST https://apex-prd.certna.org/APEX/Service/APEXPublicServer.svc/updateCOIRequest

Request Body

This endpoint accepts request parameters using an text/plain format. (They are part of the endpoint URL)

Request Headers

Key Value
Content-Type application/json
access_token {soft-token}

Request Parameters

Parm Name Req/Opt Format Description
RequestID Required [string] Use 0 when calling the web service.
COIExpirationDate Required [string] The date the updated COI will expire.
SubmitterID Required [string] The Submitter ID associated with the updated COI.

JSON Response Parameters

Parm Name Format Description
result [string] If the updateCOIRequest is successfully created, the RequestID will be returned in the result property of the response. The RequestID is needed when sending along the associated COI document for the Update COI Request.
code [string] Exception conditions will result in code/message being returned.
message [string] Longer description of exception condition.

As noted, any condition that results in an unsuccessful call to the updateCOIRequest web service will produce a JSON formatted response with a code and message property populated. Successful calls will result in the RequestID property being returned. The RequestID is a required parameter of the postDocument web service.

Sample Request

Endpoint: (With Parameters)

https://apex-prd.certna.org/APEX/Service/APEXPublicServer.svc/updateCOIRequest?RequestID=0&COIExpirationDate=12/25/2024&SubmitterID=1234

Headers:

Content-Type: application/json (For the login process)

Content-Type: text/plain (For the web service call)

Body:

Body content is not required because the parameters are pass as text/plain content as part of the Endpoint URL.

Sample Response

Status Code: 200

{
    "result": "35"
}

OR

Status Code: 500 (When an error occurs.)

{
    "Exception": {
        "Code": "SubmitterNotFound",
        "Message": "SUBMITTER ID 1234 is not found or does not belong to the requesting organization."
    }
}

Additional Comments

Comments and sample code are provided for reference purposes only and are not intended to show production quality code or all exception handling conditions and/or completed code blocks.

Comment 1:

The updateCOIRequest web service is the first step in an Update COI Request workflow as documented in the following C# snippet.

private void btnUpdateCOIRequest_Click(object sender, RoutedEventArgs e)
{
    // Update COI Request Workflow:
    // Create Update COI Request - Request ID is retured.
    // Send the COI PDF document associated with the Request ID.
    // Note: An existing 'Other' type submitter id is required for the Update COI request.
 
    updateCOIRequest(); // If successfull the tbRequestID.Text field will have the new Request ID.
 
    sendPDFFile("COIRequest");
}

Comment 2:

The following C# snippet shows how to login and call the updateCOIRequest web service. In this example, the parameters that are being supplied to the web service are copied from the fields on WPF form.

private void updateCOIRequest()
{
    string strUpdateRequestID = "0";
 
    RestClient client = null;
    RestRequest request = null;
    IRestResponse response = null;
 
    string strURL = "https://" + getHost() + "/APEX/Service/APEXPublicServer.svc/user/login";
 
    // Password has to be hashed.
    // New convention uses a Salt value from the user record
 
    string strSalt = GetSalt(tbUserName.Text);
    string strPassword = tbPassword.Password.ToString();
 
    string strHashedPassword = HashPassword(strPassword, strSalt);
 
    string strParms = "{\n\t\"user_name\" : \"";
    strParms += tbUserName.Text;
    strParms += "\",\n\t\"password\" : \"";
    strParms += strHashedPassword;
    strParms += "\"\n}";
 
    client = new RestClient(strURL);
    request = new RestRequest(Method.POST);
 
    request.AddHeader("Cache-Control", "no-cache");
    request.AddHeader("Content-Type", "application/json");
 
    request.AddParameter("Login", strParms, ParameterType.RequestBody);
    response = client.Execute(request);
 
    if (response.IsSuccessful)  // Successfully logged in and a token has been provided
    {
        var jsonResult1 = JsonConvert.DeserializeObject<dynamic>(response.Content);
        string token = jsonResult1.access_token;
 
        strURL = null;
        client = null;
        request = null;
        response = null;
 
        strURL = "https://" + getHost() + "/APEX/Service/APEXPublicServer.svc/updateCOIRequest";
        strURL = strURL + "?" + "RequestID=0";
        strURL = strURL + "&" + "COIExpirationDate=" + tbCOIExpires.Text;
        strURL = strURL + "&" + "SubmitterID=" + tbSubmitterID.Text;
 
        client = new RestClient(strURL);
        request = new RestRequest(Method.POST);
 
        request.AddHeader("Cache-Control", "no-cache");
        request.AddHeader("access_token", token);
        request.AddHeader("content-type", "text/plain");
        response = client.Execute(request);
 
        if (response.IsSuccessful)
        {
            var jsonResult2 = JsonConvert.DeserializeObject<dynamic>(response.Content);
 
            strUpdateRequestID = jsonResult2.result;
            tbRequestID.Text = strUpdateRequestID;
        }
    }
 
    return;
}

Comment 3:

A zip file with a VisualStudio 2019, C#, .NET/WPF project is available for download. The project uses NuGet packages RestSharp (Version 106.15.0) and Newtonsoft.Json (Version 13.0.1). This project will not build with RestSharp versions later than 106 due to changes in the library.

You do not have to build this project, the source code files can just be referenced for how to complete tasks associated with obtaining a soft-token so that the other web services can be called. The soft-token is a requirement on all the CeRTNA web services.

Comment 4:

As per the workflow snippet, CeRTNA expects that the required COI will be submitted as part of the workflow for creating the Update COI Request. If the COI is not provided, the Update COI Request will be rejected by CeRTNA staff.