検索

Article
· Jul 15 6m read

Composing an OpenAPI 2.0 specification.

REST API (Representational State Transfer Application Programming Interface) is a standardized way for web applications to communicate with each other using HTTP methods like GET, POST, PUT, DELETE, etc. It's designed around resources, which can be anything from a user to a file. Each resource is identified by a unique URL, and interactions with these resources are stateless, meaning each request from a client to a server must contain all the information needed to understand and process the request. This statelessness, along with the use of standard HTTP methods, makes REST APIs highly scalable, easy to understand, and straightforward to integrate with different systems. By following REST principles, developers can create APIs that are consistent, easy to use, and capable of handling a wide range of tasks.

InterSystems supports REST API development with a variety of tools and techniques. In this article series, I am going to go over the ones that I personally prefer. The articles are divided as listed below.

  • Composing an OpenAPI 2.0 specification.
  • Documenting and Developing REST APIs using OpenAPI 2.0 specification.
  • Developing an IRIS production pipeline to serve REST API calls.

As perquisite to following the steps and instructions laid out in this article series, you should have the below setup.

  1. InterSystems IRIS for Health
  2. InterSystems IAM with Dev Portal deployed and enabled.
  3. Postman or any other API testing software.

Let’s assume that we are developing a workflow for managing clinic appointments. We will focus on an appointment resource and how to develop GET, POST, PUT methods for it. You can use the same steps even to develop a DELETE method, but I am not going to do it because I personally do not prefer it.

First, you need to start with composing an OpenAPI 2.0 spec for your application APIs. I use the swagger editor for this task to be able to develop in YAML format, and then convert the spec file to JSON. I then can use the JSON file to use with IRIS API management tools. You can use the online swagger editor for free or you can download and deploy a container of it locally from here.

When I compose an OpenAPI spec, I think of the file as three sections. The intro section is where you lay out the description information. It includes fields that describe the nature of the application such as the description, license, tags that categorizes different endpoints and the URL by combining the host and base URL. It also includes the confines in the which it can operate if any such as the schemas and security definitions.

The below code block has a sample intro section that going to be reference from here on. If you paste it into an open swagger editor, you will notice that the groundwork of the API documentation is taking shape.

 

swagger: "2.0"
info:
  description: "This is a sample server to be as an example Clinic server.  You can find out more about Swagger at [http://swagger.io](http://swagger.io). For this sample, you can use the api key `special-key` or Basic Auth user `Basic` with password `Basic` to test the authorization filters."
  version: "1.0.0"
  title: "Clinic Management"
  termsOfService: "http://swagger.io/terms/"
  contact:
    email: "raef.youssef@intersystems.com"
  license:
    name: "Apache 2.0"
    url: "http://www.apache.org/licenses/LICENSE-2.0.html"
host: "apigatewaydns"
basePath: "/clinic"
tags:
- name: "Scheduling"
  description: "Everything about your Pets"
  externalDocs:
    description: "Find out more"
    url: "http://intersystems.com"
schemes:
- "http"
- "https"
securityDefinitions:
  BasicAuth:
    type: "basic"
    name: "Basic"
  api_key:
    type: "apiKey"
    name: "api_key"
    in: "header"

Second section of the spec file is the body. This is where you list the different paths, aka endpoints, and the methods that are available for each. For the purpose of this demo, we will just compose spec for the “/appointment” end point. Below is the text for that.


paths:
  /appointment:
    get:
      tags:
        - Scheduling
      summary: "Fetches an existing appointment details"
      security:
      - Basic: []
      description: "Fetches an existing appointment details by providing its ID"
      operationId: "getAppointmentByID"
      produces:
      - "application/json"
      parameters:
      - in: "query"
        name: "id"
        type: "integer"
        format: "int64"
        description: "ID of the appointment sought"
        required: true
      responses:
        '200':
          description: successful operation
#          schema:
#            $ref: '#/definitions/appointment'
    post:
      tags:
        - Scheduling
      summary: ""
      security:
      - api_key: []
      description: ""
      operationId: "postAppointment"
      consumes:
      - "application/json"
      - "application/xml"
      produces:
      - "application/json"
      - "application/xml"
      parameters:
      - in: "formData"
        name: "Date"
        type: "string"
        format: "date-time"
        description: ""
        required: true
      - in: "formData"
        name: "duration"
        type: "integer"
        format: "int64"
        description: "number of half hour slots of the appointment duration"
        required: true
      responses:
        '200':
          description: successful operation
        '405':
          description: Time not available
    put:
      tags:
        - Scheduling
      summary: ""
      security:
      - BasicAuth: []
      description: ""
      operationId: "updateAppointment"
      consumes:
      - "application/json"
      - "application/xml"
      produces:
      - "application/json"
      - "application/xml"
      parameters:
      - in: "query"
        name: "id"
        type: "integer"
        format: "int64"
        description: "ID of the appointment sought"
        required: true
      - in: "body"
        name: "body"
        description: ""
        required: true
#        schema:
#          $ref: "#/definitions/appointment"
      responses:
        '200':
          description: successful operation
        '405' :
          description: Time not available
        '406' :
          description: Appointment Not Found

A few things to note in the paths section. First, you can assign a different authentication mechanism for each method. There is an “OperationID” field which would be used to name the backend process that serves the respective method call. Furthermore, you can define a schema for a request JSON body and response, it commented out here so it won’t error when you paste as we have not defined it yet. Finally, you can define custom response codes and messages.

The last section is where different message schemas are defined. In this example, we will compose the appointment schema to include appointment ID, Date, Duration, and Provider of service name. Below is the text of the YAML definition. After pasting the below in your editor, you can uncomment the lines where the schema definition is referenced.

definitions:
    appointment:
        type: "object"
        properties:
            id:
                type: "integer"
                format: "int64"
            Provider:
                type: "string"
                format: "string"
            Date:
                type: "string"
                format: "date-time"
            Duration:
                type: "integer"
                format: "int64"

This concludes this part of the series. We are going to use this spec in the later parts of the series. They are coming soon so be on the lookout. For more information on developing OpenAPI 2.0 specification please refer to the documentation here.

Discussion (0)1
Log in or sign up to continue
Question
· Jul 15

Read-Only Role for HealthShare Messaging and Production Monitoring, to assign it to a new user.

Hello InterSystems Community,

I'm working with HealthShare, and need to create a user account for our development environment with specific access requirements. This user will need only to:

    Review messaging and environments
    See production and namespaces
    NOT modify anything (read-only access)

After reviewing the documentation on user roles and rights management, I can see the default roles available in our system include:

Ensemble/Interoperability Roles:

    %EnsRole_Administrator - Interoperability Administrator
    %EnsRole_AlertAdministrator - Interoperability user with administrative Alert access
    %EnsRole_AlertOperator - Interoperability user with Alert access
    %EnsRole_Developer - Interoperability Developer
    %EnsRole_Monitor - Interoperability Monitor
    %EnsRole_Operator - Interoperability Operator

HealthShare Specific Roles:

    %HS_Administrator
    %HS_Clinician
    %HS_Clerical
    Various BFC (Business Function Component) related roles

My Question:

Is there a predefined role in HealthShare that would allow a user to:

    View and navigate through production environments
    Access messaging systems for monitoring/troubleshooting
    Review system status and incidents (event logs)
    BUT prevent any editing or modification capabilities

I'm particularly interested in the %EnsRole_Monitor role - would this be appropriate for read-only access to messaging and production monitoring?

Or should I be looking at creating a custom role by combining specific privileges? If so, what would be the recommended approach for a read-only monitoring user?

Any guidance on best practices for this type of user setup would be greatly appreciated.

Thank you.

I have also read, before asking here:

    https://community.intersystems.com/post/user-roles-and-rights-management
    
    https://docs.intersystems.com/iris20241/csp/docbook/Doc.View.cls?KEY=GSA...
    
    https://docs.intersystems.com/iris20241/csp/docbook/Doc.View.cls?KEY=GSA...
    

Thank you again sincerely.

2 Comments
Discussion (2)2
Log in or sign up to continue
Question
· Jul 15

I think I am getting an error with a CSP Page, "Invalid action", what does this mean?

I am doing a form POST to myself (same class) and when I do the form action it gets a page similar to the error page but just says:

Invalid action

There is nothing in the application error log. How can I troubleshoot this?

1 Comment
Discussion (1)2
Log in or sign up to continue
Question
· Jul 15

CalmEars Tinnitus Relief Australia Facts Checked: Ingredients, Reviews & More

Shop me>>>> https://allsupplement.org/calmears-tinnitus-relief-au/

 

<<<<CalmEars Tinnitus Relief Australia>>>>

This has caused the emergence of products like CalmEars Tinnitus Relief Australia, which market themselves as natural hearing

 

FACEBOOK>>>> https://www.facebook.com/CalmEarsTinnitusReliefAustralia/

FACEBOOK>>>> https://www.facebook.com/groups/calmearsaustralia/

FACEBOOK>>>> https://www.facebook.com/groups/calmearstinnitusreliefcapsulesau/

FACEBOOK>>>> https://www.facebook.com/groups/silensensecalmearstinnitusreliefau/

FACEBOOK>>>> https://www.facebook.com/groups/silensensecalmearstinnitusreliefaustralia/

FACEBOOK>>>> https://www.facebook.com/events/1198160915444605/

JIMDO>>>> https://calmearstinnitusreliefaustralia.jimdosite.com/

PDF>>> https://heyzine.com/flip-book/e618e4d8c6.htm

BUY NOW>>> https://filmfreeway.com/CalmEarsTinnitusReliefAustralia

BUY NOW>>> https://sites.google.com/view/calmears-tinnitus-relief-aus/home

BUY NOW>>> https://site-dcxramc9d.godaddysites.com/

BUY NOW>>> https://github.com/Jennifensen/CalmEars-Tinnitus-Relief-Australia/

BUY NOW>>> https://colab.research.google.com/drive/1LH2VWjNAYR53bzXjA3JSeOmfiGjuGqRy

BUY NOW>>> https://medium.com/@CalmEarsTinnitusReliefAus

BUY NOW>>> https://gns3.com/community/discussions/calmears-tinnitus-relief-australia-customer-warning-is-it-a-worthy-formula-to-treat-tinnitus

BUY NOW>>> https://nas.io/calmears-tinnitus-relief-australia/challenges/calmears-tinnitus-relief-australia-reviews-and-complaints-you-may-try-it-my-suggestion

BUY NOW>>> https://knowt.com/note/b16cb66a-c881-4c74-90ce-0b7c590e520a/CalmEars-Tinnitus-Relief-Australia-Analy

BUY NOW>>> https://fmcreators.com/index.php?threads/calmears-tinnitus-relief-australia-official-website-support-your-healthy-hearing.23496/

Discussion (0)1
Log in or sign up to continue
Article
· Jul 15 4m read

IRISのプロセス(処理)を停止させる方法

これは InterSystems FAQ サイトの記事です。

IRISのプロセスを終了したい場合、管理ポータルから行う方法と、ターミナルからユーティリティやコマンドを使用して行う方法があります。

こちらのトピックでは、以下の3つの方法で停止する方法をご紹介します。

【プロセスの停止方法】
1.管理ポータルから停止する方法
2.ユーティリティーで停止する方法(RESJOB、JOBEXAM)
3.プログラムで停止する方法


【注意】
IRIS外から(Windowsならタスクマネージャーなど)、プロセスの終了は絶対に行わないでください。

IRIS外からプロセス終了してしまうと、IRIS内部ではプロセスの削除を検知できなかったりすることで、IRISの動作が不安定になったり、システム全体がハングする危険性がありますので、ご注意ください。

外部から停止の例外が一つだけあります。
$ZF コマンドによって起動された子プロセスが、何らかの問題で応答を返さなかった場合、$ZF コマンドを実行した親プロセスはそのまま残り続けます。
そのような親プロセスを終了したい場合、通常の上記1~3の方法では停止できません。
その際は、先に外部から子プロセスを停止する必要があります。子プロセスを特定するためには、以下の方法があります。

例:Windowsの場合
1. process explorer(マイクロソフト製)
2. PowerShell コマンド
   PS>wmic Process where '(parentprocessid=10188)' get 'processid,executablepath'


では、以下に通常のプロセスを停止する方法をご紹介します。
 

1.管理ポータルから停止する方法

システムオペレーション > プロセス
よりプロセス一覧を表示し、終了したいプロセスの 詳細 リンクをクリックし、詳細ページを開きます。

 

終了ボタンをクリックすると、モーダルダイアログが開くので、終了ボタンを押してプロセスを終了します。

 


 

2.ユーティリティーで停止する方法(RESJOB、JOBEXAM)

管理者権限でターミナルにログインし、ユーティリティを実行します。

★RESJOB

USER>zn "%SYS"
%SYS>do ^RESJOB
Force a process to quit InterSystems IRIS
 
Process ID (? for status report): 56528   // 終了したいプロセスIDを入力+Enter で終了する
Process ID (? for status report):         // Enter で抜ける( ? を入れるとプロセス一覧が表示される)
%SYS>

★JOBEXAM

%SYS>do ^JOBEXAM
                IRIS for Windows (x86-64) 2025.1 (Build 225_1U)
 Job# NSpace  Routine        Commands   Globals State      PID Current device
    1         CONTROL               0         0 RUNW     66824
    2         WRTDMN               26       357 RUNW     18340
    3         GARCOL                0         0 RUNW     48172
    4         JRNDMN              156        25 RUNW     44180
    5         EXPDMN                0         0 RUNW     46292
    6 %SYS    %SYS.WorkQueueMgr133834     13242 SEMW     42112 //./nul
    7 %SYS    MONITOR           31238        78 EVTW     62572 //./nul
    8 %SYS    CLNDMN                0        21 RUNW     58484 //./nul
    9 %SYS    LMFMON             1587        80 EVTW     17168 //./nul
   10 %SYS    RECEIVE             795        97 HANGW    17212 //./nul
   11 USER    shell               362        37 READ     41016 |TRM|:|41016   // これを終了する場合
   12 %SYS    %SYS.WorkQueueMgr 77088      7396 EVTW      3848 //./nul
   13 %SYS    %SYS.SERVER           0        17 READ     48840 1972:
   14 %SYS    %SYS.TaskSuper     2073       135 EVTW     22480 //./nul
   15 %SYS    SYS.VSSWriter         0        14 RUNW      6884 //./nul
   16 %SYS    %SYS.Monitor.Co<5697596   2242094 EVTW     26840 //./nul
   17 %SYS    %SYS.WorkQueueMgr  4763       156 SEMW     39616 //./nul
   19 %SYS    %SYS.sqlcq.uEidd<133559      1338 RUN      37884 |TRM|:|37884
(N)ext,(P)rev,(G)oto,(E)xamine,(T)erminate,(S)uspend,(R)esume,(Q)uit =>       // T 押下(Terminate)
Terminate: Enter Job # or "P" followed by the PID: P41016                     // P+プロセスID または Job番号を入力+EnterJob Terminated でプロセスが終了する


3.プログラムで停止する方法

USER>zn "%SYS"
%SYS>do $SYSTEM.Process.Terminate(17456)   // ^RESJOB ユーティリティと同じ。プロセスIDを指定して終了する
%SYS>
 
%SYS>do $SYSTEM.Process.Terminate()        // 自分自身(現在の)プロセスを終了する場合
Discussion (0)0
Log in or sign up to continue