Skip to content

Commit 4385e6a

Browse files
authored
Merge pull request #8 from TymurL/fix-rest-api
2 parents c7406a4 + e237a29 commit 4385e6a

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ or open the folder in VSCode and do the following:
3434
## How to Work With it
3535

3636
This template creates /crud REST web-application on IRIS which implements 4 types of communication: GET, POST, PUT and DELETE aka CRUD operations.
37-
These interface works with a sample persistent class Sample.Person.
37+
These interface works with a sample persistent class dc.Sample.Person.
3838

3939
Open http://localhost:52773/swagger-ui/index.html to test the REST API
4040

@@ -43,9 +43,9 @@ Open http://localhost:52773/swagger-ui/index.html to test the REST API
4343
To test GET you need to have some data. You can create it with POST request (see below), or you can create some fake testing data. to do that open IRIS terminal or web terminal on /localhost:52773/terminal/ and call:
4444

4545
```
46-
USER>do ##class(Sample.Person).AddTestData(10)
46+
USER>do ##class(dc.Sample.Person).AddTestData(10)
4747
```
48-
This will create 10 random records in Sample.Person class.
48+
This will create 10 random records in dc.Sample.Person class.
4949

5050

5151
You can get swagger Open API 2.0 documentation on:
@@ -84,7 +84,7 @@ Adjust the authorisation if needed - it is basic for container with default logi
8484

8585
and send the POST request to localhost:52773/crud/persons/
8686

87-
This will create a record in Sample.Person class of IRIS.
87+
This will create a record in dc.Sample.Person class of IRIS.
8888

8989
# Testing PUT request
9090

src/dc/Sample/PersonREST.cls

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,30 +34,30 @@ ClassMethod GetInfo() As %Status
3434
RETURN ..%ProcessResult($$$OK, info)
3535
}
3636

37-
/// Retreive all the records of Sample.Person
37+
/// Retreive all the records of dc.Sample.Person
3838
ClassMethod GetAllPersons() As %Status
3939
{
4040

4141
#dim tSC As %Status = $$$OK
4242

43-
Set rset = ##class(Sample.Person).ExtentFunc()
43+
Set rset = ##class(dc.Sample.Person).ExtentFunc()
4444

4545
Set %response.ContentType = ..#CONTENTTYPEJSON
4646
Write "["
4747
if rset.%Next() {
48-
Set person = ##class(Sample.Person).%OpenId(rset.ID)
48+
Set person = ##class(dc.Sample.Person).%OpenId(rset.ID)
4949
Do person.%JSONExport()
5050
}
5151
While rset.%Next() {
5252
Write ","
53-
Set person = ##class(Sample.Person).%OpenId(rset.ID)
53+
Set person = ##class(dc.Sample.Person).%OpenId(rset.ID)
5454
Do person.%JSONExport()
5555
}
5656
Write "]"
5757
Quit tSC
5858
}
5959

60-
/// Return one record fo Sample.Person
60+
/// Return one record fo dc.Sample.Person
6161
ClassMethod GetPerson(id As %Integer) As %Status
6262
{
6363
#dim tSC As %Status = $$$OK
@@ -67,7 +67,7 @@ ClassMethod GetPerson(id As %Integer) As %Status
6767
#; Set the response header to plain text
6868
Set %response.ContentType = ..#CONTENTTYPEJSON
6969

70-
Set person = ##class(Sample.Person).%OpenId(id)
70+
Set person = ##class(dc.Sample.Person).%OpenId(id)
7171

7272
If '$IsObject(person) Quit ..Http404()
7373

@@ -76,12 +76,12 @@ ClassMethod GetPerson(id As %Integer) As %Status
7676
Quit tSC
7777
}
7878

79-
/// Creates a new Sample.Person record
79+
/// Creates a new dc.Sample.Person record
8080
ClassMethod CreatePerson() As %Status
8181
{
8282
#dim tSC As %Status = $$$OK
8383
#dim e As %Exception.AbstractException
84-
Set person = ##class(Sample.Person).%New()
84+
Set person = ##class(dc.Sample.Person).%New()
8585
Set data=%request.Content
8686

8787

@@ -96,12 +96,12 @@ ClassMethod CreatePerson() As %Status
9696
Quit tSC
9797
}
9898

99-
/// Update a record in Sample.Person with id
99+
/// Update a record in dc.Sample.Person with id
100100
ClassMethod UpdatePerson(id As %Integer) As %Status
101101
{
102102
#dim tSC As %Status = $$$OK
103103
#dim e As %Exception.AbstractException
104-
Set person = ##class(Sample.Person).%OpenId(id)
104+
Set person = ##class(dc.Sample.Person).%OpenId(id)
105105
If '$IsObject(person) Return ..Http404()
106106
Set data=%request.Content
107107

@@ -116,12 +116,12 @@ ClassMethod UpdatePerson(id As %Integer) As %Status
116116
Quit tSC
117117
}
118118

119-
/// Delete a record with id in Sample.Person
119+
/// Delete a record with id in dc.Sample.Person
120120
ClassMethod DeletePerson(id As %Integer) As %Status
121121
{
122122
#dim tSC As %Status = $$$OK
123123
#dim e As %Exception.AbstractException
124-
Set person = ##class(Sample.Person).%OpenId(id)
124+
Set person = ##class(dc.Sample.Person).%OpenId(id)
125125
If '$IsObject(person) Return ..Http404()
126126

127127
$$$TOE(tSC,person.%DeleteId(id))

0 commit comments

Comments
 (0)