IC4J API Docs
  • Overview
    • Introduction
  • Quick Start
  • License
  • Reference
    • API Reference
      • Install IC4J Libraries
      • Supported Types
      • ReplicaTransport
      • Identity
      • Principal
      • AgentBuilder
      • ProxyBuilder
      • Using IDLArgs
      • QueryBuilder and UpdateBuilder
      • Using Raw Agent Methods
      • Handle Binary Payloads
      • Object Serializers and Deserializers
        • Pojo Serializer and Deserializer
        • JSON Jackson Serializer and Deserializer
        • JSON Gson Serializer and Deserializer
        • XML DOM Serializer and Deserializer
        • XML JAXB Serializer and Deserializer
        • JDBC Serializer
      • Android Development
Powered by GitBook
On this page
  1. Reference
  2. API Reference

Using Raw Agent Methods

PreviousQueryBuilder and UpdateBuilderNextHandle Binary Payloads

Last updated 1 year ago

Another option to invoke QUERY and UPDATE canister methods from Java is to use raw methods queryRaw and updateRaw.

CompletableFuture<byte[]> response = agent
    .queryRaw(Principal.fromString(canisterId),
        Principal.fromString(effectiveCanisterId),
         "echoInt",
          payload,
          ingressExpiryDatetime);
CompletableFuture<byte[]> response = agent
    .updateRaw(Principal.fromString(canisterId),
        Principal.fromString(effectiveCanisterId),
         "greetjav",
          payload,
          ingressExpiryDatetime);

To get the status of the Internet Computer, use status Agent method. It will return the Java type as follows.

Status status = agent.status().get();
Agent
Status