You can retrieve information about entities and aggregates in a solution by making REST
API calls.
Before you begin
Set up role-based access control to the REST API commands
and review the REST API reference topics.
About this task
Because you can use a browser to call REST API methods,
getting values is useful for testing. For example, you can check in
a browser whether an entity is created or verify the current value
of a global aggregate.
Procedure
- To retrieve an entity value, enter a GET request in the
following form:
https://localhost:port/ibm/ia/rest/solutions/solution_name/entity-types/entity_type/entities/entity_id
For example, the following request uses the regex parameter and returns a range of
CustomerID entities that are in the BankingSolution
solution:https://localhost:9443/ibm/ia/rest/solutions/BankingSolution/entity-types/CustomerID/entities/?regex=id[200-205]
- To retrieve the value of a shared aggregate, enter a GET request in the following form:
https://localhost:port/ibm/ia/rest/solutions/solution_name/entity-types/entity_type/entities/entity_id/aggregate/shared_aggregate_name
For example, the following request returns the value of the DepositCount shared aggregate
in a
solution:https://localhost:9443/ibm/ia/rest/solutions/BankingSolution/entity-types/Customer/entities/GoldCustomer/aggregate/DepositCount
- To get the value of a shared aggregate in Java when you are using the TestDriver API, use the
method getname, where name
is the name of the shared aggregate. You can specify the time of the most recent event
(now), a specific ZonedDateTime value, or a time period.
For example, if you defined a
buyer entity and a shared aggregate that has the
name
indicator, the following code returns the current value of the shared
aggregate:
Object value = buyer.getIndicator(ZonedDateTime.now());
The following code returns the current value of the shared aggregate within a time period of 5
minutes before or after
now:
timePeriod = TimePeriod.create(now.plusMinutes(5), now.plusMinutes(15));
value = trader.getIndicator(timePeriod);
- To retrieve a global aggregate value, enter a GET request
in the following form:
https://localhost:port/ibm/ia/rest/solutions/solution_name/aggregate/aggregate_name
You
must include the defvar prefix in the name of the
global aggregate.
If you omit aggregate_name,
all the global aggregates in the solution are returned.
For example, the following request returns the current value
of the MaxDeposit global aggregate in the BankingSolution solution:https://localhost:9443/ibm/ia/rest/solutions/BankingSolution/aggregate/defvarMaxDeposit