Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

Description

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

Package Details

Interface

IServiceRegulatedEntityManager

Syntax

Task<ICollection<ServiceRegulatedEntity>> Add(int serviceRequestId, ICollection<ServiceRegulatedEntity> serviceRegulatedEntities)

Returns

ICollection<ServiceRegulatedEntity>

API

POST - /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

Sample request body – This is a sample which adds the values of the regulated entity ids for the specified service request.

Notes: Only the values should be modified. The values are associated to an entity id. You cannot use the same service request id when adding new regulated entities. This is a constraint in the database.

This example is for service id 123 and type VESSEL. You can get a list from the GetList page.

[ 
 {
     "Id": 1,
     "Value": "test 1 "  
 },
 {
     "Id": 2,
     "Value": "test 2"  
 },
 {    "Id": 3,
     "Value": "test 3"  
 },
 {    "Id": 4,
     "Value": "test 4"  
 }
]

Returns

HTTP 200 - OK

Returns a list of regulated entities with their ids, English and French display names. The ids are returned based on a sort order.

Is there’s no regulated entity ids found, an empty list is returned.

Sample response body – Returns the added values.

[
  {
    "Id": 1,
    "Value": "test 1 "
  },
  {
    "Id": 2,
    "Value": "test 2"
  },
  {
    "Id": 3,
    "Value": "test 3"
  },
  {
    "Id": 4,
    "Value": "test 4"
  }
]

Example

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

//Use your own service request id.
const int serviceRequetId = 1234;

//Make sure to use the proper ids from the GetList function.
var regulatedEntities = new List<ServiceRegulatedEntity>
 {
     new ServiceRegulatedEntity
     {
         Id = 1,
         Value = "Your value"
      },
      new ServiceRegulatedEntity
      {
         Id = 2,
         Value = "Your value"
      },
      new ServiceRegulatedEntity
      {
          Id = 3,
          Value = "Your value"
      },
      new ServiceRegulatedEntity
      {
          Id = 4,
          Value = "Your value"
      }
  };
  
var newServiceRegulatedEntities = await ServiceRegulatedEntityManager.Add(serviceRequestId, regulatedEntities);
  • No labels