Sign inSign up

manyos/rapi

By manyos

Updated 6 days ago

Remedy Rest API

Image
0

50K+

manyos/rapi repository overview

RAPI - REST API for BMC Remedy AR System

RAPI is a REST API proxy that provides a simple HTTP interface to the BMC Remedy AR System. It translates standard HTTP methods (GET, POST, PUT, PATCH, DELETE) into AR System API calls, allowing any HTTP client to interact with Remedy forms without requiring the native AR System SDK.

Requirements

  • JDK 17
  • Gradle 7.6.4 (included via wrapper)
  • Network access to a BMC Remedy AR System server

Quick Start

Local Development
./gradlew bootRun -Dgrails.server.port=8080
Docker
docker build -t rapi .
docker run -p 8080:8080 rapi

Authentication

All API requests require HTTP Basic Authentication. The provided credentials are passed through to the AR System server to authenticate against Remedy.

curl -u "username:password" http://localhost:8080/myserver/MyForm

API Reference

The URL structure follows the pattern:

http://host:port/{server}/{form}/{query}
  • server - The AR System server hostname
  • form - The Remedy form (schema) name
  • query - An AR System qualification string
Optional Query Parameters
ParameterDefaultDescription
port0AR System server port
formatJSONResponse format: JSON or XML
fieldNamestrueReturn field names instead of field IDs
translateSelectionFieldstrueTranslate selection field IDs to display values
fieldsallComma-separated list of field names or IDs to return
firstEntry0Index of the first record to return (pagination)
maxEntries0 (all)Maximum number of records to return
sortnoneSort fields, e.g. Status,-CreateDate (prefix - for descending)
dateFormatEEE MMM dd HH:mm:ss zzz yyyyJava SimpleDateFormat pattern for dates
countOnlyfalseReturn only the record count
cacheResultsfalseCache query results in memory
cacheTime600000Cache duration in milliseconds
showDisplayOnlyFieldsfalseInclude display-only fields in results
formDetailsfalseReturn detailed form metadata (with form list)
showServerConfigfalseReturn server configuration
showServerStatisticsfalseReturn server statistics
impersonateUsernoneImpersonate a different AR System user
rpcQueuenoneUse a specific RPC queue

GET - Query Records
List all forms on a server
curl -u user:pass http://localhost:8080/myserver

Response:

{
  "status": "success",
  "forms": ["Form1", "Form2", "Form3"]
}
List all forms with details
curl -u user:pass "http://localhost:8080/myserver?formDetails=true"
Get field definitions of a form
curl -u user:pass http://localhost:8080/myserver/HPD:Help%20Desk

Response:

{
  "status": "success",
  "form": "HPD:Help Desk",
  "fields": [
    {
      "name": "Incident Number",
      "fieldId": 1000000161,
      "type": "CharacterField",
      "entryMode": "Optional",
      "valueMapping": null
    }
  ]
}
Query records
curl -u user:pass "http://localhost:8080/myserver/HPD:Help%20Desk/'Status'=\"Assigned\""

Response:

{
  "status": "success",
  "query": "'Status'=\"Assigned\"",
  "server": "myserver:0",
  "form": "HPD:Help Desk",
  "runtime": 234,
  "dataSize": 5,
  "data": [
    {
      "id": "INC000000000123",
      "values": {
        "Incident Number": "INC000000000123",
        "Status": "Assigned",
        "Summary": "Example incident"
      }
    }
  ]
}
Query with pagination and sorting
curl -u user:pass "http://localhost:8080/myserver/HPD:Help%20Desk/'Status'=\"Assigned\"?firstEntry=0&maxEntries=10&sort=-CreateDate"
Query with specific fields
curl -u user:pass "http://localhost:8080/myserver/HPD:Help%20Desk/'1'!=%24NULL%24?fields=Incident%20Number,Status,Summary"
Count records only
curl -u user:pass "http://localhost:8080/myserver/HPD:Help%20Desk/'Status'=\"Assigned\"?countOnly=true"

Response:

{
  "form": "HPD:Help Desk",
  "query": "'Status'=\"Assigned\"",
  "dataSize": 42,
  "runtime": 89
}
Query via POST body
curl -u user:pass -X POST http://localhost:8080/search \
  -H "Content-Type: application/json" \
  -d '{
    "server": "myserver",
    "form": "HPD:Help Desk",
    "query": "'Status'=\"Assigned\""
  }'
Get server configuration
curl -u user:pass "http://localhost:8080/myserver?showServerConfig=true"
Get server statistics
curl -u user:pass "http://localhost:8080/myserver?showServerStatistics=true"

POST - Create Records

Create one or more new records on a form. The request body is a JSON object where each key is a label (returned in the response) and each value contains the field data.

curl -u user:pass -X POST http://localhost:8080/myserver/HPD:Help%20Desk \
  -H "Content-Type: application/json" \
  -d '{
    "entry1": {
      "Summary": "New incident from API",
      "Status": "New",
      "Impact": "4-Minor/Localized"
    }
  }'

Response:

{
  "entry1": "INC000000000456"
}

Fields can be referenced by name or field ID.


PUT - Update Records

Update an existing record. Identify the record by ID or by query.

Update by ID
curl -u user:pass -X PUT http://localhost:8080/myserver/HPD:Help%20Desk \
  -H "Content-Type: application/json" \
  -d '{
    "id": "INC000000000123",
    "values": {
      "Status": "Resolved",
      "Resolution": "Fixed via API"
    }
  }'
Update by query
curl -u user:pass -X PUT http://localhost:8080/myserver/HPD:Help%20Desk \
  -H "Content-Type: application/json" \
  -d '{
    "query": "'Incident Number'=\"INC000000000123\"",
    "values": {
      "Status": "Resolved"
    }
  }'
Multi-match options

When a query matches multiple records, control behavior with multiMatchOption:

ValueBehavior
0Error if multiple matches
1Update only the first match
2Update all matches (default)

Response:

[
  {
    "message": "success",
    "entry": {
      "id": "INC000000000123",
      "values": { "Status": "Resolved" }
    }
  }
]

PATCH - Merge Records

Similar to PUT, but uses the AR System merge operation. Useful for upsert-like behavior.

curl -u user:pass -X PATCH http://localhost:8080/myserver/HPD:Help%20Desk \
  -H "Content-Type: application/json" \
  -d '{
    "id": "INC000000000123",
    "values": {
      "Status": "In Progress"
    },
    "mergeOptions": 1028
  }'

The mergeOptions parameter controls the merge behavior (default: 1028). See BMC documentation for available merge option values.


DELETE - Delete Records

Delete all records matching a query.

curl -u user:pass -X DELETE "http://localhost:8080/myserver/HPD:Help%20Desk/'Incident Number'=\"INC000000000123\""

Response:

{
  "INC000000000123": "success"
}

Pagination parameters (firstEntry, maxEntries) can be used to limit which matched records are deleted.


Attachments
Download an attachment
GET /{server}/{form}/getAttachment/{entryId}/{fieldId}
curl -u user:pass -o attachment.pdf \
  http://localhost:8080/myserver/HPD:Help%20Desk/getAttachment/INC000000000123/600001
Upload an attachment
POST /{server}/{form}/setAttachment/{entryId}/{fieldId}
curl -u user:pass -X POST \
  -F "file=@/path/to/document.pdf" \
  http://localhost:8080/myserver/HPD:Help%20Desk/setAttachment/INC000000000123/600001

Maximum file size: 200 MB.


Response Formats

All endpoints support JSON (default) and XML output. Set format=XML to receive XML responses.

curl -u user:pass "http://localhost:8080/myserver/MyForm/'1'!=%24NULL%24?format=XML"

Date Formats

Dates are returned in the format specified by the dateFormat parameter. The following input formats are supported when creating or updating records:

  • EEE MMM dd HH:mm:ss zzz yyyy (default, e.g. Mon Jan 01 12:00:00 CET 2024)
  • yyyy-MM-dd'T'HH:mm:ss'Z' (ISO 8601)
  • yyyy-MM-dd'T'HH:mm:ss
  • yyyy-MM-dd HH:mm:ss
  • dd.MM.yyyy'T'HH:mm:ss'Z'
  • dd.MM.yyyy'T'HH:mm:ss
  • dd.MM.yyyy HH:mm:ss

Error Handling

On error, the API returns HTTP 500 with an error message:

{
  "status": "error",
  "message": "ARException: Entry does not exist in database"
}

Field Caching

Field definitions are cached in memory for 10 minutes per server/user/form combination. This reduces round-trips to the AR System server for repeated queries against the same form.

Tag summary

Content type

Image

Digest

sha256:e5455454d

Size

704 MB

Last updated

6 days ago

docker pull manyos/rapi