GetSparqlStream - Neptune Data API


Gets a stream for an RDF graph.

With the Neptune Streams feature, you can generate a complete sequence of change-log entries that record every change made to your graph data as it happens. GetSparqlStream lets you collect these change-log entries for an RDF graph.

The Neptune streams feature needs to be enabled on your Neptune DBcluster. To enable streams, set the neptune_streams DB cluster parameter to 1.

See Capturing graph changes in real time using Neptune streams.

When invoking this operation in a Neptune cluster that has IAM authentication enabled, the IAM user or role making the request must have a policy attached that allows the neptune-db:GetStreamRecords IAM action in that cluster.

Note that the neptune-db:QueryLanguage:Sparql IAM condition key can be used in the policy document to restrict the use of SPARQL queries (see Condition keys available in Neptune IAM data-access policy statements).

Request Syntax

GET /sparql/stream?commitNum=commitNum&iteratorType=iteratorType&limit=limit&opNum=opNum HTTP/1.1 Accept-Encoding: encoding

URI Request Parameters

The request uses the following URI parameters.


The commit number of the starting record to read from the change-log stream. This parameter is required when iteratorType isAT_SEQUENCE_NUMBER or AFTER_SEQUENCE_NUMBER, and ignored when iteratorType is TRIM_HORIZON or LATEST.


If set to TRUE, Neptune compresses the response using gzip encoding.

Valid Values: gzip


Can be one of:

  • AT_SEQUENCE_NUMBER   –   Indicates that reading should start from the event sequence number specified jointly by the commitNum and opNum parameters.

  • AFTER_SEQUENCE_NUMBER   –   Indicates that reading should start right after the event sequence number specified jointly by the commitNum and opNum parameters.

  • TRIM_HORIZON   –   Indicates that reading should start at the last untrimmed record in the system, which is the oldest unexpired (not yet deleted) record in the change-log stream.

  • LATEST   –   Indicates that reading should start at the most recent record in the system, which is the latest unexpired (not yet deleted) record in the change-log stream.



Specifies the maximum number of records to return. There is also a size limit of 10 MB on the response that can't be modified and that takes precedence over the number of records specified in the limit parameter. The response does include a threshold-breaching record if the 10 MB limit was reached.

The range for limit is 1 to 100,000, with a default of 10.

Valid Range: Minimum value of 1. Maximum value of 100000.


The operation sequence number within the specified commit to start reading from in the change-log stream data. The default is 1.

Request Body

The request does not have a request body.

Response Syntax

HTTP/1.1 200 Content-type: application/json { "format": "string", "lastEventId": { "string" : "string" }, "lastTrxTimestamp": number, "records": [ { "commitTimestamp": number, "data": { "stmt": "string" }, "eventId": { "string" : "string" }, "isLastOp": boolean, "op": "string" } ], "totalRecords": number }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.


Serialization format for the change records being returned. Currently, the only supported value is NQUADS.

Type: String


Sequence identifier of the last change in the stream response.

An event ID is composed of two fields: a commitNum, which identifies a transaction that changed the graph, and an opNum, which identifies a specific operation within that transaction:

Type: String to string map


The time at which the commit for the transaction was requested, in milliseconds from the Unix epoch.

Type: Long


An array of serialized change-log stream records included in the response.

Type: Array of SparqlRecord objects


The total number of records in the response.

Type: Integer


For information about the errors that are common to all actions, see Common Errors.


Raised when a request timed out in the client.

HTTP Status Code: 408


Raised when a value in a request field did not satisfy required constraints.

HTTP Status Code: 400


Raised when a request attempts to access an stream that has expired.

HTTP Status Code: 400


Raised when an argument in a request is not supported.

HTTP Status Code: 400


Raised when an argument in a request has an invalid value.

HTTP Status Code: 400


Raised when a parameter value is not valid.

HTTP Status Code: 400


Raised when a request fails because of insufficient memory resources. The request can be retried.

HTTP Status Code: 500


Raised when a precondition for processing a request is not satisfied.

HTTP Status Code: 400


Raised when stream records requested by a query cannot be found.

HTTP Status Code: 404


Raised when the rate of requests exceeds the maximum throughput. Requests can be retried after encountering this exception.

HTTP Status Code: 500


Raised when the number of requests being processed exceeds the limit.

HTTP Status Code: 429


Raised when a request attempts to initiate an operation that is not supported.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: