Hi Kevin, thank you for your question. Global Masters and Global Masters Gamification Platform are the same. 
@Timothy Leavitt thank you! The link was broken indeed  - already fixed it 👌 Good day to all!

Thank you @Timothy Leavitt !
A child object gives more flexibility and is easier to understand for people doing support in 1 year or 2  

 

@Timothy Leavitt  - stuck again.

I'm in ClassMethod UserInfo, and found out some interesting things.

First off, I was wrong about the REST service using the session cookie from the Zen application when it is called from the Zen application. Displaying the %session.SessionId parameters for each call shows that they are all different, and not the same as the SessionId of the Zen application calling the REST service. So the idea that it holds a license for 10 seconds can't be correct, as it seems almost immediate. I run 20 REST calls to different endpoints in a loop, and I saw a single License increase.

You said I should be able to expose the session cookie of the Zen application, but I don't see a way to do that either.

I can't even find a way to see the header data in the UserInfo ClassMethod of the current REST call.

Sorry to be a pest...but since you''re giving answers, I'll keep asking questions!

Have a nice evening...

@Timothy Leavitt  - thanks so much for the response. The Action worked perfectly with your corrections!

I will take your advice and work with the %session/headers in the context object, since that makes the most sense.

What are the plans (if any) to enable features in a resultset such as pagination, filters, and sorting?

Users are horrible, aren't they? No matter what good work you do, they always want more! I appreciate what you have done here, and it will save my company probably hundreds of hours of work, plus it is very elegant...

@Timothy Leavitt , I will be looking for it.

I'm trying to do something with a custom Header that I want to provide for  the REST calls. Do I have access to the REST Header somewhere in the service that I can pull the values, like a %request?

And in something of an edge case, we're calling these REST services from an existing ZEN application (for now as we start a slow pull away from Zen), so the ZEN app gets a %Session created for it, and then calls the REST service. It seems that Intersystems is managing the License by recognizing that the browser has a session cookie, and it doesn't burn a License for the REST call - that's very nice (but I do have a request in to the WRC about whether that is expected behavior or not so I don't get surprised if it gets "fixed"!). Does that mean your REST service can see that %Session, as that would be very helpful, since we store User/Multi-tenant ID, and other important things in there (the %Session, not the cookie).

@Timothy Leavitt, I've run into another issue.

The proxy is setup and working great for general GET access. But since my system is a multi-tenant, wide open queries are not a thing I can use, so I decided to try to use a defined class Query in the data class Lookups.Terms:

Query ContactsForClientID(cClientOID As %String) As %SQLQuery
{
SELECT 
FROM Lookups.Terms
WHERE ClientID = :cClientOID
ORDER BY TermsCode
}

Then I setup the Action Mapping in my proxy class RESTProxies.Lookups.Terms.Base:

XData ActionMap [ XMLNamespace = "http://www.intersystems.com/apps/rest/action]
{
<actions xmlns="http://www.intersystems.com/apps/rest/action">
<action name="byClientID" target="class" method="GET" 
modelClass="Lookups.Terms" query="Lookups.Terms:ContactsForClientID">
<argument name="clientid" target="cClientOID" source="url"/>
</action>
</actions>
}

And I invoked this using this URL in a GET call using Postman (last part only):

terms_base/$byClientID?clientid=290

And the result:

406 - Client browser does not accept the MIME type of the requested page.

In the request, I verified that both Content-Type and Accept are set to application/json (snip from the Postman):

So what have I missed?

Seems like the JSONTYPE as Property-Parameter is only available in IRIS.

Therefore I've now implemented the solution suggested by @Timothy Leavitt with own datatype-classes using the JSONTYPE class-paramter. So far it seems to work.

Hope we could upgrade to IRIS anytime soon. But unfortunately we are not quite there yet.

Thanks!

Thomas

Some more findings what happens:
The output methods are code generated. And the generator just uses JSONTYPE from the data type class.
That means that even as the property parameter is available in Studio, ... you can't change it.

example: Property bool as %Boolean (JSONTYPE="string")  is just ignored  and you see ,"bool":false

This means: JSONTYPE is frozen in the data type class
Bringing Parameter JSONTYPE into the class (e.g, by %ZJSON.Adaptor) has no influence to the Generator 

To achieve the expected result you require a customized data class as suggested by  @Timothy Leavitt 

Out of 25 only these 7 6  classes are affected the rest is string which is default anyhow.

boolean %Library.Boolean.cls(JSONTYPE): Parameter JSONTYPE 
number  %Library.Currency.cls(JSONTYPE): Parameter JSONTYPE 
number  %Library.Decimal.cls(JSONTYPE): Parameter JSONTYPE 
number  %Library.Float.cls(JSONTYPE): Parameter JSONTYPE 
number  %Library.Integer.cls(JSONTYPE): Parameter JSONTYPE 
number  %Library.Numeric.cls(JSONTYPE): Parameter JSONTYPE 
number  %Library.PosixTime.cls(JSONTYPE): Parameter JSONTYPE  not in Caché

I added auditing on everything, and the <PROTECT> error never showed up. So, I started everything from scratch and found out a typo on Postman. blush

Thanks, @Eduard Lebedyuk @Timothy Leavitt 

PS: Sorry, guys. I think not sleeping enough hours isn't good for health and cause this kind of mistakes laugh

Hi @Timothy Leavitt 
I'm testing the AppS.REST to create a new application, following the Tutorial and Sample steps in Github I created a Dispatch Class: 

Class NPM.REST.Handler Extends AppS.REST.Handler
{
ClassMethod AuthenticationStrategy() As %Dictionary.CacheClassname
{
    Quit ##class(AppS.REST.Authentication.PlatformBased).%ClassName(1)
} 
ClassMethod GetUserResource(pFullUserInfo As %DynamicObject) As AppS.REST.Authentication.PlatformUser
{
    Quit ##class(AppS.REST.Authentication.PlatformUser).%New()
}
}

And a simple persistent class:

 Class NPM.Model.Task Extends (%Persistent, %Populate, %JSON.Adaptor, AppS.REST.Model.Adaptor)
{ 
Parameter RESOURCENAME = "task"; 

Property RowID As %String(%JSONFIELDNAME = "_id", %JSONINCLUDE = "outputonly") [ Calculated, SqlComputeCode = {Set {*} = {%%ID}}, SqlComputed, Transient ]; 

Property TaskName As %String(%JSONFIELDNAME = "taskName"); 

/// Checks the user's permission for a particular operation on a particular record.
/// <var>pOperation</var> may be one of:
/// CREATE
/// READ
/// UPDATE
/// DELETE
/// QUERY
/// ACTION:<action name>
/// <var>pUserContext</var> is supplied by <method>GetUserContext</method>
ClassMethod CheckPermission(pID As %String, pOperation As %String, pUserContext As AppS.REST.Authentication.PlatformUser) As %Boolean
{
    Quit ((pOperation = "QUERY") || (pOperation = "READ") || (pOperation = "CREATE") || (pOperation = "UPDATE"))
}
}

But when I try the REST API using Postman GET: http://localhost:52773/csp/npm-app-rest/api/task/1

I'm getting a 404 Not Found message.

Am I doing something wrong or missing something?

Thanks

Article
Evgeny Shvarov · May 7, 2020 4m read
Unit Testing with ZPM

Hi Developers!

I want to share with you the approach you can use working with Unit Testing which I personally find very convenient and robust.

Will not talk much here about Unit Testing, we have documentation, enough good articles on the topic not only on the Internet but here on Developers Community too,  e.g. this one.

How can you manage the Unit Testing of your ZPM module?

This is pretty handy with ZPM. It has a special command "test" which runs all the tests you mentioned in the module. You can execute it as shown below:

zpm:USER>module-name test

And this command runs all the tests you mentioned in module.xml.

Let's see how it works.

20
2 93 0

Hello @Timothy Leavitt
Thank you for this great article!

I tried to add "UnitTest" tag to my module.xml but something wrong during the publish process.
<UnitTest Name="tests" Package="UnitTest.Isc.JSONFiltering.Services" Phase="test"/>

tests directory contain a directory tree UnitTest/Isc/JSONFiltering/Services/ with a %UnitTest.TestCase sublcass.

Exported 'tests' to /tmp/dirLNgC2s/json-filter-1.2.0/tests/.tests
ERROR #5018: Routine 'tests' does not exist
[json-filter]   Package FAILURE - ERROR #5018: Routine 'tests' does not exist
ERROR #5018: Routine 'tests' does not exist


I also tried with objectscript-math project.  This is the output of objectscript-math publish -v :

Exported 'src/cls/UnitTests' to /tmp/dir7J1Fhz/objectscript-math-0.0.4/src/cls/unittests/.src/cls/unittests
ERROR #5018: Routine 'src/cls/UnitTests' does not exist
[objectscript-math]     Package FAILURE - ERROR #5018: Routine 'src/cls/UnitTests' does not exist
ERROR #5018: Routine 'src/cls/UnitTests' does not exist

Did I miss something or is a package manager issue ?
Thank you.

Our team is reworking an application to use REST services that use the same database as our current ZEN application. One of the new REST endpoints uses a query that ran very slowly when first implemented. After some analysis, we found that an index on one of the fields in the table greatly improved performance (a query that took 35 seconds was now taking a fraction of a second).

30
0 214 4

@Mike Davidovich 

You are most welcome.  In terms of why TestCoverage was released on OpenExchange, it is something we have been exploring internally last year and wanted to share with the Community in time for Global Summit 2018.  In terms of whether or not it will actually make it into product, I can't speak to that but perhaps the author @Timothy Leavitt  can comment on that (I believe there were at least exploratory discussions with Product Management on this topic).

Hi Community!

New Badges're already on Global Masters Advocacy Hub

We're happy to announce that this year we again introduced three annual badges on Global Masters Advocacy Hub to let you remember how much you contributed to Developer Community in 2018. Here they are:

 DC Best-Selling Author 2018
 DC Expert 2018
 DC Opinion Leader 2018

Let's take a closer look at the DC Wall of Fame 2018 and greet everyone with big applause! 

00
0 158 0

Hi Community!

New Badges're already on Global Masters Advocacy Hub

We're happy to announce that this year we again introduced three annual badges on Global Masters Advocacy Hub to let you remember how much you contributed to Developer Community in 2018. Here they are:

 DC Best-Selling Author 2018
 DC Expert 2018
 DC Opinion Leader 2018

Let's take a closer look at the DC Wall of Fame 2018 and greet everyone with big applause! 

80
0 221 5