Description
Updates a collection regulated entity ids for a specified service request.
Package Details
Interface
Code Block | ||
---|---|---|
| ||
IServiceRegulatedEntityManager |
Syntax
Code Block | ||
---|---|---|
| ||
Task<ICollection<ServiceRegulatedEntity>> Update(int serviceRequestId, ICollection<ServiceRegulatedEntity> serviceRegulatedEntities) |
Returns
Code Block | ||
---|---|---|
| ||
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 | ||
---|---|---|
| ||
[
{
"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 | ||
---|---|---|
| ||
[
{
"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 | ||
---|---|---|
| ||
//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); |