Creating sequences in your preferred editor

Creating sequences in your preferred editor

Developers are fussy - we want to write code in the editor we usually use. That's fine with Sequence API because we are completely API driven. So you have some options:

  1. Use our API directly
  2. Write an integration in JS using our node module
  3. Use our command line tool, available if you install our node module globally.

In this example we are going to use the third option. Below, I install the module globally:

I now use a text editor to create a new sequence:

I enter my JSON (I've cut and paste this example from the New Sequence function in the browser):

Then we just run the command to upload to Sequence API using -c to indicate we are creating it, and the file we just created:

If the sequence is valid (more on that below) then Sequence responds with the ID of the new sequence, and a url to view it:

Editing a Sequence

We can use the same approach for editing sequences. I return to my file and, in this case, edit the name:

When uploading I use the -u (update) parameter, instead of -c, and the -s parameter to indicate the ID the sequence being updated:

If successful, the reponse provides the new version number. As an aside, you can see below the initial attempt was rejected becaus eI mistyped my password):

And you can see the change to the name in the browser:

Validating syntax and definition

When you create or edit a sequence, Sequence API will validate your JSON. There may be two classes of error, invalid JSON or invalid definition:

Invalid JSON

I have returned to the file and added an extra curly bracket at the start, that invalidates the JSON:

Now when I attempt the update:

Invalid definition

Here, I have fixed the bracket, but removed the name, which is a required attribute:

The result now is: