Get Nodes

Lists the nodes in your graph.

The Get Nodes API lists the nodes in the graph. By default, the API sorts nodes by their in-degree (that is, the number of edges that point to the specified node). This allows you to find the most important nodes in the graph. You can use the ids and name attributes of nodes as inputs to other graph actions.

Quick Start

The following example returns the top five pages in Wikipedia by in-degree.

POST /1/api/[async|sync]/getnodes/v1?max_results=5

The API returns the id, name attribute, and sort value for each node. The sort value here is the in-degree of the node.

{
  "nodes":[
    {
      "id": 521,
      "sort_value": 432558,
      "attributes": {
        "name": "United States"
      }
    },
    {
      "id": 9377,
      "sort_value": 210273,
      "attributes": {
        "name": "List of sovereign states"
      }
    },
    {
      "id": 45648,
      "sort_value": 189450,
      "attributes": {
        "name": "Animal"
      }
    },
    {
      "id": 23255,
      "sort_value": 142969,
      "attributes": {
        "name":"Association football"
      }
    },
    {
      "id": 1135,
      "sort_value": 137539,
      "attributes": {
        "name": "France"
      }
    }
  ]
}
Synchronous
https://api.havenondemand.com/1/api/sync/getnodes/v1
Asynchronous
https://api.havenondemand.com/1/api/async/getnodes/v1
Authentication

This API requires an authentication token to be supplied in the following parameter:

Parameter Description
apikey The API key to use to authenticate the API request.
Parameters

This API accepts the following parameters:

Optional
Name Type Description
graph
enum The graph you want to query. Default value: wiki_eng.
max_results
number The maximum number of results to return. Default value: 6.
sort
enum The sorting method to use for the results. Default value: default.
Enumeration Types

This API's parameters use the enumerations described below:

graph
The graph you want to query.
wiki_eng English Wikipedia
Graph where the nodes come from English Wikipedia pages.
sort
The sorting method to use for the results.
default Default
Uses a default sorting algorithm, which sorts nodes by in-degree (the number of edges that point to the node).
none None
Turn off sorting. You might want to use this option to improve the speed of particularly large queries.

This API returns a JSON response that is described by the model below. This single model is presented both as an easy to read abstract definition and as the formal JSON schema.

Asynchronous Use

Additional requests are required to get the result if this API is invoked asynchronously.

You can use /1/job/status/<job-id> to get the status of the job, including results if the job is finished.

You can also use /1/job/result/<job-id>, which waits until the job has finished and then returns the result.

Model
This is an abstract definition of the response that describes each of the properties that might be returned.
Get Nodes Response {
nodes ( array[Nodes] , optional)
}
Get Nodes Response:Nodes {
attributes ( Attributes )
id ( integer ) Node ID.
sort_value ( integer , optional) The value of the property used to sort the nodes. The default is in-degree.
}
Get Nodes Response:Nodes:Attributes {
name ( string ) The name of the node.
}
Model Schema
This is a JSON schema that describes the syntax of the response. See json-schema.org for a complete reference.
{
    "properties": {
        "nodes": {
            "items": {
                "properties": {
                    "attributes": {
                        "properties": {
                            "name": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "name"
                        ],
                        "type": "object"
                    },
                    "id": {
                        "minimum": 0,
                        "type": "integer"
                    },
                    "sort_value": {
                        "minimum": 0,
                        "type": "integer"
                    }
                },
                "required": [
                    "id",
                    "attributes"
                ],
                "type": "object"
            },
            "type": "array"
        }
    },
    "type": "object"
}
https://api.havenondemand.com/1/api/sync/getnodes/v1
/api/api-example/1/api/sync/getnodes/v1
Examples
See this API for yourself - select one of our examples below.
Get Nodes (English)
Retrieve English wikipedia graph nodes
Parameters
Optional
Name Type Value
graph
enum
max_results
number
sort
enum


ASync – Response An error occurred making the API request
Response Code:
Response Body

	
Making API Request…
Checking result of job

To try this API with your own data and use it in your own applications, you need an API Key. You can create an API Key from your account page - API Keys.

Output Refresh An error occurred making the API request View Input
Rendered RawHtml Response
Result Display
Response Code:
Response Body:

			
Make this call with curl


If you would like to provide us with more information then please use the box below:

We will use your submission to help improve our product.