# sfxapi

> The JavaScript client for the Signalfx API

Latest version **0.1.5** (published 2014-08-27) · 0 weekly downloads

## Install

```sh
npm install sfxapi
pnpm add sfxapi
yarn add sfxapi
bun add sfxapi
```

Provides the command `sfxapi`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2014-08-27 |
| First published | 2014-08-27 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ozan Turgut |
| Maintainers | ozanturgut |

## Links

- npm: https://www.npmjs.com/package/sfxapi
- Repository: https://github.com/signalfx/sfxapi.js
- Issues: https://github.com/signalfx/sfxapi.js/issues
- npm.io page: https://npm.io/package/sfxapi

## Dependencies (3)

- [swagger-cli-client](https://npm.io/package/swagger-cli-client.md) ^0.1.10
- [swagger-ajax-client](https://npm.io/package/swagger-ajax-client.md) ^0.2.0
- [swagger-node-client](https://npm.io/package/swagger-node-client.md) ^0.2.0

## Recent versions

- 0.1.5 (latest) — 2014-08-27
- 0.1.4 — 2014-08-27

## README

# sfxapi.js

The JavaScript client for the [Signalfx API](https://api.signalfuse.com/ui).

## In the browser
To use, include one of these files in your application: 
* *[sfxapi.js](https://raw.githubusercontent.com/signalfx/sfxapi.js/master/dist/sfxapi.js)*
* *[sfxapi.js.min](https://raw.githubusercontent.com/signalfx/sfxapi.js/master/dist/sfxapi.min.js)*, a minified version ([source map](https://raw.githubusercontent.com/signalfx/sfxapi.js/master/dist/sfxapi.min.js.map))

You may also `bower install sfxapi` to install using bower. Once you've included the script, you can use the global `sfxapi` object to issue requests:

```javascript
sfxapi.token(API_TOKEN);
sfxapi.job.getInstance('BuVusGuAYAA')
  .then(function(job){
    // do something with the job object
  }).catch(function(response){
    // this is called when an error occurs
    // response.error includes the error object
    // response.data is the response body
    // response.code is the HTTP code of the response
  });
```

## In Node.js
Install the package by executing `npm install --save sfxapi`. After it has been installed you can add `var sfxapi = require('sfxapi');` to your application and use it in the same way you would use the browser version of the client.

## As a CLI
To interact with the Signalfx API from your client, install [Node.js](http://nodejs.org/) and run `npm install -g sfxapi` in your terminal.

```shell
# install signalfx api cli
$ npm install -g sfxapi

# list resources
$ sfxapi

# list operations on a resource
$ sfxapi <resource>

# perform an operation
$ sfxapi <resource> <operation> --<param-name> <param-value>

# For operations with a single parameter or a single required parameter
# you may omit the dashdash.
$ sfxapi metric search sf_metric:*mysql*
```

### Authorization
You may pass your api key via the `--auth <token>` parameter for each call, or create a `SFXAPI_AUTH` environment variable for the token, or create a yaml/json file called `.sfxapi` with a `auth` key in the user home directory (e.g., `~/.sfxapi`).

### Example

![Usage example](https://s3.amazonaws.com/uploads.hipchat.com/46701/950499/68t8LOUcwSG4dMg/1__bash.png)

---
_Source: https://npm.io/package/sfxapi · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
