Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Updates a collection regulated entity ids for a specified service request.

Package Details

Interface

Code Block
languagec#
IServiceRegulatedEntityManager

Syntax

Code Block
languagec#
Task<ICollection<ServiceRegulatedEntity>> Update(int serviceRequestId, ICollection<ServiceRegulatedEntity> serviceRegulatedEntities)

Returns

Code Block
languagec#
ICollection<ServiceRegulatedEntity>

API

PUT - /api/v1/regulated-entities

Parameters

Parameter

Description

Type

serviceRequestId

The service request id associated to the regulated entity.

The service request must exist.

Query string

serviceRegulatedEntities

A collection of service regulated entities.

Body

Sample request body – This is a sample which updates the value(s) of the service request regulated entities.

Notes: Only the values should be modified. The ids are associated to service request regulated entity values.

You can get all of the ids and values from the GetAll.

Code Block
languagejson
[
  {
    "Id": "VESSEL_NM",
    "Value": "test"
  },
  {
    "Id": "CDN_SHIP_IND",
    "Value": "test"
  },
  {
    "Id": "IMO",
    "Value": "test"
  },
  {
    "Id": "OFFICIAL_NO",
    "Value": "test"
  }
]

Returns

HTTP 200 - OK

Returns a list of service request regulated entity values with their ids.

Sample response body – Returns the added values.

Code Block
languagejson
[
  {
    "Id": "VESSEL_NM",
    "Value": "test"
  },
  {
    "Id": "CDN_SHIP_IND",
    "Value": "test"
  },
  {
    "Id": "IMO",
    "Value": "test"
  },
  {
    "Id": "OFFICIAL_NO",
    "Value": "test"
  }
]

Example

Note: Make sure to use the proper ids from the GetAll function.

Code Block
languagec#
//Use your own service request id.
const int serviceRequetId = 1234;

var serviceRequestRegulatedEntities = await ServiceRegulatedEntityManager.GetAll(serviceRequestId);
var regulatedEntities = new List<ServiceRegulatedEntity>();
foreach (var serviceRequestRegulatedEntity in serviceRequestRegulatedEntities)
{
    regulatedEntities.Add(new ServiceRegulatedEntity
    {
        Id = serviceRequestRegulatedEntity.RegulatedEntityIdTypeCode,
        Value = "Updated value"
     });
}

var updated = await ServiceRegulatedEntityManager.Update(serviceRequestId, regulatedEntities);