Node Service: send and debug a request

Send a request. See the error in your Shinami dashboard. Look up what to do in our Error Guide.

You'll learn how to

  • Send a request to Aptos Node Service.
  • View your requests and error codes in your Shinami dashboard
  • Get guidance on a specific error code in our Error guide.

Steps

1. Create a Shinami account

You’ll need a Shinami account to follow this quick-start guide.

2. Create an API Access Key

To use Shinami's products, you need an API access key to authenticate your requests. Set up a Node Access key for Testnet as shown here in our Authentication and API Keys guide

3. Make a request!

Here is an example GET /accounts/address request that returns a not found error. We're producing the error by sending an address that doesn't exist.

The TypeScript example uses the Shinami Clients SDK.

curl https://api.shinami.com/aptos/node/v1/accounts/0x94db619929656f03fe42081c3d421cdd3caa3bf5346fe8cf22d49dbfda540ea \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_TESTNET_NODE_ACCESS_KEY"
import { createAptosClient } from "@shinami/clients/aptos";
const shinamiAptosClient = createAptosClient("YOUR_TESTNET_NODE_ACCESS_KEY");

const resp = await aptosClient.getAccountInfo({ accountAddress: "0x94db619929656f03fe42081c3d421cdd3caa3bf5346fe8cf22d49dbfda540ea0" });
console.log(resp);

Example Response

{
  "message":"Account not found by Address(0x94db619929656f03fe42081c3d421cdd3caa3bf5346fe8cf22d49dbfda540ea) and Ledger version(6190817592)",
  "error_code":"account_not_found",
  "vm_error_code":null
}
[AptosApiError]: Request to [Fullnode]: GET https://api.shinami.com/aptos/node/v1/accounts/0x094db619929656f03fe42081c3d421cdd3caa3bf5346fe8cf22d49dbfda540ea0 failed with: {"message":"Account not found by Address(0x94db619929656f03fe42081c3d421cdd3caa3bf5346fe8cf22d49dbfda540ea0) and Ledger version(6190822871)","error_code":"account_not_found","vm_error_code":null}
    at ... {
  url: 'https://api.shinami.com/aptos/node/v1/accounts/0x094db619929656f03fe42081c3d421cdd3caa3bf5346fe8cf22d49dbfda540ea0',
  status: 404,
  statusText: 'Not Found',
  data: {
    message: 'Account not found by Address(0x94db619929656f03fe42081c3d421cdd3caa3bf5346fe8cf22d49dbfda540ea) and Ledger version(6190822871)',
    error_code: 'account_not_found',
    vm_error_code: null
  },
  request: {
    url: 'https://api.shinami.com/aptos/node/v1',
    method: 'GET',
    originMethod: 'getInfo',
    path: 'accounts/0x094db619929656f03fe42081c3d421cdd3caa3bf5346fe8cf22d49dbfda540ea',
    contentType: undefined,
    acceptType: undefined,
    params: undefined,
    overrides: {
      API_KEY: 'aptos_testnet_b4511a5a676faaf92965d1228b9fc6cb',
      HEADERS: {}
    }
  }
}

4. View the request and error in your dashboard

On the Aptos Node Service page of your Shinami dashboard, click the "REST API Insights" tab. Note that it can take a few minutes for a request to show up. If your request hasn't shown up yet, just keep reading this doc to learn about the metrics and error guide, then refresh the insights page when you're done.

  1. Each service has its own page with its own API insights.
  2. Some services, like Aptos Node Service, have tabs to choose between multiple sets of insights.
  3. Filters: I've chosen "Aptos Testnet" and "Last 60 minutes" to narrow down to this one error. You can also filter by a specific API key and by a specific method. The default is "All keys" and "All methods" as shown above.
  4. Summary metrics: a great place to get a quick overview of your integration health. If there's an issue - like a lot of rate-limit or other errors, you can scroll down to the graphs below to see more detail.
  5. Graphs: this is the first one, showing the request we've sent. If you sent more, you'll see those as well, grouped by request name.

Scroll down to view more graphs, including a breakdown by Aptos and HTTP error codes. These are grouped by error code across all requests that match the filter at the top of the page, so remember that you can filter by a specific method name if needed.

After taking the screenshot above, I sent two more failed requests, which is why there are now three entries:

5. See what the error means in our Error guide

Our Error guide has an overall section for all Shinami Services, as well as a specific section for each service, including Aptos REST API. If we go there you can see a sample error, as well as links to guidance on HTTP codes and Aptos errors. In this case, the guidance to "check for all error codes and messages returned" is key. Our message was "Account not found by Address(0x94db619929656f03fe42081c3d421cdd3caa3bf5346fe8cf22d49dbfda540ea) and Ledger version(6190817592)",. This tells us that either the account does not exist, or it did not exist at the ledger version asked for (which, since we didn't provide one, was the latest ledger version at the time).

6. Send a successful request

Let's update the request to ask for a successful address we know exists on Testnet.

Updated request

curl https://api.shinami.com/aptos/node/v1/accounts/0x94db619929656f03fe42081c3d421cdd3caa3bf5346fe8cf22d49dbfda540eae \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_TESTNET_NODE_ACCESS_KEY"
import { createAptosClient } from "@shinami/clients/aptos";
const shinamiAptosClient = createAptosClient("YOUR_TESTNET_NODE_ACCESS_KEY");

const resp = await aptosClient.getAccountInfo({ accountAddress: "0x94db619929656f03fe42081c3d421cdd3caa3bf5346fe8cf22d49dbfda540eae" });
console.log(resp);

Successful response

{
  "sequence_number":"5297769",
  "authentication_key":"0x94db619929656f03fe42081c3d421cdd3caa3bf5346fe8cf22d49dbfda540eae"
}
{
  sequence_number: '5297750',
  authentication_key: '0x94db619929656f03fe42081c3d421cdd3caa3bf5346fe8cf22d49dbfda540eae'
}

To read about what these return fields mean, see our API doc.

Next step: build on Aptos! 🏗