Version Control

You can create a stream either in DataSift's GUI or via an API call. Version control for your CSDL source code is automatically available for all the streams that you create in the GUI. Streams that you create via the API are not versioned. Here are the details you need to know about version control and versioning.

Streams created via the API

When you create a stream via an API call, Datasift gives the stream a hash..

hash

To create a stream via the API, you use the /compile endpoint in the REST API. There is no way to edit a stream using the API so versioning is not required. If you need to alter your CSDL, simply compile a new stream.

The recommended way to consume a stream is with the Streaming API. You can consume any stream that you own. You can also consume any public stream, regardless of who owns it, as long as you know its hash.

How do I find the hash for a stream in the API?

The /compile endpoint returns the hash when you compile your stream. It's important that you make a note of the hash because there is no way to retrieve it later.

Streams created via the GUI

A stream that you create via the GUI can have versions. Every time that you edit the stream in the GUI, DataSift creates a new version. DataSift gives each version its own hash, unless the edit was trivial; for example: adding whitespace. The GUI allows you to see the version history and revert to an earlier version.

ui-versions

Once you have created a stream via the GUI, you can preview it in the GUI or consume it via the API. If you preview the stream in the GUI, you will see the output from the latest version of the stream. However, if you decide to run a stream via the API, you can select any version you want, addressing it by means of its hash.

How do I find the hash for a version of a stream in the GUI?

Suppose a stream created in the GUI has seven versions: 1, 2, 3, 4, 5, 6, and 7, where 1 is the earliest version and 7 is the latest.

To see the version hsitory, select the stream and click Edit Definition. DataSift displays the history next to the CSDL code window. For our example, it looks like this:

versionhistory

Each of these streams has it's own hash. If you already know the hash for the version that you want to use, you can run the stream via the Streaming API immediately.

To find the hash of an older version, revert to that old version temporarily, then revert back to the latest version:

  1. Make a note of the current version. In our example it is version 7.
  2. Edit the version for which you want to find the hash.
  3. Save this older version. It now becomes version 8.
  4. Click the big green Use Stream button (see below). DataSift displays the hash.
  5. Now, to revert to version 7, edit it.
  6. Save version 7. It now becomes a new revision, version 9.
UseStream