0.0.3 • Published 5 years ago
wrms v0.0.3
WRMS interface
An API client interface to WRMS.
Usage
const WRMS = require('wrms')
const wrms = new WRMS({
endpoint: 'https://wrms.example.org',
username: 'username',
password: 'password'
})
wrms.user.lookup({field: 'email', key: 'user@example.org'})
.then((res) => {
// res is a resultset of users
})
wrms.work_request.search({q: 'search term'})
.then((res) => {
// res is a resultset of work requests
})Tests
Credentials for tests live in .env. These need to be valid for your WRMS environment (eg WRMS_TEST_USER_MAIL will be an existing user's email). See tests for more.
WRMS_URL=https://wrms.example.org
WRMS_USERNAME=exampleuser
WRMS_PASSWORD=secretpass
WRMS_TEST_USER_MAIL=user@example.org
WRMS_TEST_WR_SEARCH_TERM="search term"
WRMS_TEST_WR_ID=123But wait! There's more variables you can set in .env.
WRMS_SSL_INSECURE=truewhen someone forgets to renew a cert
TODO
- Permit
new WRMS(creds)to accept{ endpoint: 'xx', wrms3_auth: 'xyz' }if we already have a cookie. (Is this a good idea or does it encourage bad ones?) - Do we need WRMSv2 API endpoints? Seems like there are some useful parts there, like "recent timesheets".
- If
WRMS_EXTRA_COOKIESisn't set, politely reject calls to v2 API. docs/assign-user.js- WRMS forms don't let you easily assign a user to a ticket outside their systems, but I suspect API will.- Is
api.php/times/recordAPI v1, andapi2/request_updateAPI v2? Does API v2 correspond to WRMS v3? (api2/loginreturnswrms3_authcookie). Yes. API v1 is WRMS v2; API v2 is WRMS v3.
References
- WRMS3
- WRMS API v2
- WRMS API v1
- PHP client libs
- Perl client libs
- WR#286231: Port wr.php to WRMSv3 and make it API driven
Related projects
Other things that might be of interest.
0.0.3
5 years ago