Robert Cemper · May 28, 2022 go to post
set sc=rs.Execute("a")

You pass a paramter,
but there is no need for a parameter visible.  NO ? in query

try

set sc=rs.Execute()

Robert Cemper · May 28, 2022 go to post

just after

Do Httprequest.EntityBody.Write(mystring)
Do Httprequest.EntityBody.%Save()

As with any other object

Robert Cemper · May 28, 2022 go to post

Httprequest.EntityBody is a %GlobalBinaryStream object.
In your code I see

Do Httprequest.EntityBody.Write(mystring)

But no %Save()  to take care of completion and persistence of the object

Robert Cemper · May 26, 2022 go to post

Congrats!
By manual intervention, you managed to get your index out of sync with your date.
Check this Repairing your Index

Sorry the method is not yet available in 2014.1 you need a Rebuildindex (from SMP)

Robert Cemper · May 25, 2022 go to post

Check acces rights to the files.
Especially for the Windows USER your Caché installation is runing on. 

Robert Cemper · May 23, 2022 go to post

Once again I fail to follow the repeated almost religious secret of $LIST() encoding
that is celebrated by Support and Engineering over decades.
Especially when the use of the knowledge is labeled "illegal".
That's just disappointing.

The problem of a possible unexpected change rather indicates incomplete Release Notes to me. 

Robert Cemper · May 22, 2022 go to post

Do you expect to save #1) the input JSON object or
#2) a dump of the converted result?
For both:

set stream=##class( %Stream.GlobalCharacter).%New()

#1)  with myjson as your JSON input

do stream.Write(myjson)
do stream.%Save() 

#2) dump the generated Object  obj  using my package Full-OBJ-Dump described here

do ##class(Z.obj).dumpToStream(.stream,obj,1)
do stream.%Save()  
Robert Cemper · May 20, 2022 go to post

try:

Set REC="CANTON,TX.,75103"Set li=$LFS(REC)
SET ZIP=$li(li,3)
SET STA= $li(li,2)
SET CTY=$li(li,1)
Robert Cemper · May 17, 2022 go to post

As you operate on 2014.*  just write it down as any other string.

after 2017.1 you may (but are not forced to) use %DynamicObjects and %%DynamicArrays.
but the result looks the same 

Robert Cemper · May 17, 2022 go to post

Status= 1 justteslls you tht the HTTP connection was processed OK.
Next you need to take a look into your response object.

set res=Httprequest.HttpResponse
in terminal then ZW res to see in the Status is 200 OK
otherwise what you see I  res.Data might be just an error page.
Which is also OK for HTTP but not for your content.

• property ReasonPhrase as %String;

This is the human readable reason that goes with the StatusCode.

• property StatusCode as %Integer;

The HTTP status code. This is useful to determine if the request was successful. Look in the rfc for HTTP to see which codes are supported and what they mean. A human readable form of this code is stored as the ReasonPhrase

• property StatusLine as %String;

The HTTP status line. This is the first line of the response and signals if the request was successful or if there was a problem.

Robert Cemper · May 6, 2022 go to post

Now with the class definition available, I understand(?) what you are looking for.
I see 2 possible solutions: embedded SQL or an Index on Title
#1

ClassMethod TitleToRowId(title) As %String 
    [ PublicList = (title, rowid, SQLCODE) ]
{
  &SQL(
     SELECT RowId into :rowid 
     FROM REST.TITLE 
      WHERE Title = :title
      )
  if 'SQLCODE quit rowid
  quit SQLCODE
}
 

btw: SQLCODE=0 means success. 
and you get the RowId by 

SET RowId=##class(REST.TITLE).TitleToRowId(obj.Title)  ;obj=JSON
SET task.Title = ##class(RESTAPI.TITLE).%OpenId(RowId)
SET book.Title = ##class(RESTAPI.TITLE).%OpenId(RowId) ; recent example

#2
 creating an Index on Title in REST.TITLE.
 but you have all trouble on duplicates, max. string length on that index
 So I'd position it as elegant but rather risky on maintenance
 

Robert Cemper · May 6, 2022 go to post

therefore I asked for a FULL class definition for BOOK!
But I got just 1 line.
there can't be help without sufficient information

Robert Cemper · May 6, 2022 go to post

Now, this gets clear.
With the keyword IDKEY you replaced the default ID naming it RowID.

To store it:

set book=##class(BOOK).%New()
set book.RowId=obj.ID     ;  from JSON obj
set book.Title=obj.Title    ;  from JSON obj
do book.%Save()

to retrieve an existing Rowid:

set book=##class(BOOK).%OpenId(obj.ID)   ;from JSON obj
,;; access or change your book.Title
Robert Cemper · May 5, 2022 go to post

I'm sorry. it seems you don't understand what I'm talking about.
You just gave me the names. Not the structure and definition. 

Expected example:

Class RestApi.Books Extends %Persistent
{
Property Title As %String;
Property Pages As %Integer; 

Storage Default
{
<Data name="BooksDefaultData">
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Title</Value>
</Value>
<Value name="3">
<Value>Pages</Value>
</Value>
</Data>
<DataLocation>^RestApi.BooksD</DataLocation>
<DefaultData>BooksDefaultData</DefaultData>
<IdLocation>^RestApi.BooksD</IdLocation>
<IndexLocation>^RestApi.BooksI</IndexLocation>
<StreamLocation>^RestApi.BooksS</StreamLocation>
}
}
 
 Class RestApi.Title Extends %Persistent
{
Property Title As Books;
Property Text As %String; 

Storage Default
{
<Data name="TitleDefaultData">
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Title</Value>
</Value>
<Value name="3">
<Value>Text</Value>
</Value>
</Data>
<DataLocation>^RestApi.TitleD</DataLocation>
<DefaultData>TitleDefaultData</DefaultData>
<IdLocation>^RestApi.TitleD</IdLocation>
<IndexLocation>^RestApi.TitleI</IndexLocation>
<StreamLocation>^RestApi.TitleS</StreamLocation>
}
}


it's midnight now. I finish 

maybe next week.

Robert Cemper · May 5, 2022 go to post

the story is clear.  Your class definition is not.
once more pls show class definitions for RESTAPI.TITLE   and    ??.BOOK   
(every class has also a package, default is User) 
you may need Studio od VSCode  to see it.

and {"ID":17, "Title":"LEARNING CAHE REST API"} is a
Dynamic JSON object unrelated to any class definition

Robert Cemper · May 5, 2022 go to post

This returns to what we were talking about yesterday.

You mix classes with JSON objects and RowID might be something different.
so pls add the definition of the classes you talk about (e.g: RESTAPI.TITLE and  TITLE table ??)
it's not obvious what you refer to in "object withoutID but having RowID" ???

How did you get the screenshot?

Robert Cemper · May 5, 2022 go to post

Assuming your RowId is unique you can define a unique Index on it.

Index RowIdx On RowId [ Type = index, Unique ];

now (after building that index) you can open your object by its RowID​​​​​​​

SET task.Title = ##class(RESTAPI.TITLE).RowIdxOpen(RowID)
Robert Cemper · May 5, 2022 go to post

Every Database in Caché or IRIS has a "NickName" (TEST, APP, USER, *TEMP, ..)
The file location is just a pointer related to the location of the file used
Similar Resource is an attribute to this "NickName".  and NOT to the related file
Changing it affects user access, but doesn't care at all about the file location.
The *.DAT file has no information about Resources or its NickName.  
Way back in the past, when file sizes were limited by file systems, there were
"Continuation" Files for Cache.DAT. Those knew the starting Cache.DAT.
But this is decades back and gone and doesn't exist anymore. 

Robert Cemper · May 5, 2022 go to post

To find this quoting in Windows kept me busy for quite a while 2 months ago
as it wasn't part of the README.md  !
 

GRAND MERCI !

Robert Cemper · May 3, 2022 go to post
  • so your obj is a DynamicObject and looks something like { "ID":17, "Title": 44 }
  • class All.Allbooks has this Property Title As User.Book. 
  • To set it you need an oref !!

therefore to create the required oref :

SET task.Title = ##class(User.Book).%OpenId(obj.Title)