# @haulmont/jmix-rest

> JavaScript library for working with Jmix REST API

Latest version **0.9.2** (published 2022-02-04) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @haulmont/jmix-rest
pnpm add @haulmont/jmix-rest
yarn add @haulmont/jmix-rest
bun add @haulmont/jmix-rest
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.9.2 |
| Published | 2022-02-04 |
| First published | 2020-12-09 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=12 |
| Dependencies | 0 |
| Unpacked size | 155.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Haulmont |
| Maintainers | cuba-platform |

## Links

- npm: https://www.npmjs.com/package/@haulmont/jmix-rest
- Repository: https://github.com/haulmont/jmix-frontend/tree/master/packages/jmix-rest
- Homepage: https://github.com/haulmont/jmix-frontend
- npm.io page: https://npm.io/package/@haulmont/jmix-rest

## Recent versions

- 0.9.2 (latest) — 2022-02-04
- 2.0.0-next.11 (next) — 2022-03-15
- 2.0.0-development.0 (dev) — 2021-12-22
- 3.2.0-next.2 — 2022-02-04
- 3.2.0-next.1 — 2022-01-27
- 3.2.0-next.0 — 2022-01-19
- 3.1.0-next.0 — 2022-01-12
- 1.2.0 — 2022-01-10
- 2.0.0-next.10 — 2021-12-22
- 2.0.0-next.9 — 2021-12-17
- 2.0.0-next.8 — 2021-12-15
- 2.0.0-next.7 — 2021-12-14
- 2.0.0-next.6 — 2021-12-10
- 2.0.0-next.5 — 2021-12-06
- 2.0.0-next.4 — 2021-11-25
- … 35 more at https://npm.io/package/@haulmont/jmix-rest/versions

## README

# Jmix REST

[![Build Status](https://travis-ci.org/cuba-platform/cuba-rest-js.svg?branch=master)](https://travis-ci.org/cuba-platform/cuba-rest-js)

JavaScript library for web and Node.js which facilitates Jmix REST API usage.
 
## Installation

### npm

```bash
npm install @haulmont/jmix-rest --save
```
Import as module  
```javascript
const jmixRest = require('@haulmont/jmix-rest');
```

Or using ES6 imports:

```javascript
import * as jmixRest from '@haulmont/jmix-rest';
```

## Dependencies and requirements
Library has no external dependencies. It's assumed that `Promise` and `fetch` -compatible API are available 
or polyfilled i.e. in node environment:
  
```bash
npm install node-fetch --save
```

```javascript
global.fetch = require('node-fetch');
```

## Usage

```javascript
import * as jmix from '@haulmont/jmix-rest';

const app = jmix.initializeApp({
  name: 'myApp',
  apiUrl: 'http://localhost:8080/rest/'
});

app.getUserInfo().then((d) => {
  console.log(d);
});

// retrieve app by name

const myApp = cuba.getApp('myApp');
```
or use if you want to manage instances yourself

```javascript
const myApp = new JmixRestConnection("myApp", "/rest/")
```

```javascript
myApp.loadEntities('sec$User', {view: '_instance_name', sort: 'login'}).then((users) => {
  console.log(users);
});
```

[Full API reference](https://docs.jmix.io/jmix/0.x/frontend-ui/latest-cuba-rest-js.html)

## Development

### Tests
In order to run integration tests you need Java to be [installed](https://doc.cuba-platform.com/manual-latest/setup.html).
#### Integration tests
```bash
npm run test:integration
```
#### Running manually
Start test CUBA app
```bash
npm run start-test-app
```
Run tests
```bash
npm test
```
Stop test app
```bash
npm run teardown-test-app
```

### Build
```bash
npm run dist
```

### Lint
```bash
npm run lint
```

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