Question Vikram Annadurai · Jul 17, 2019

Getting "Service Unavailable" Error on PostMan

Hi Guys,

    I am new to Cache, I am trying to create an simple REST API on Studio and testing it with postman before that i have config the Web Application System > Security Management > Web Applications > Edit Web Application and i have attached my snapshot also with this post.

   When i testing it on postman i am getting "Service Unavailable" error. I really don't know where i did a mistake. I tried to console it on my code, when I the postman Url is not calling my code,So i think i did a mistake on my config part. Please give me some suggestion

Thanks in advance...

Web Application Configuration:

PostMan Error:

PropertyName.cls

CROSRestApi.cls

Comments

Kurro Lopez · Jul 17, 2019

Hi Vikram,

Have you checked if you have granted privileges?

Best regards,

Francisco Lopez

0
Vikram Annadurai  Jul 17, 2019 to Kurro Lopez

Hi Francis,

 Yeah I added that. Then also I getting that same error.

0
Eduard Lebedyuk · Jul 17, 2019

Please post CROSRestAPI as text.

Can you get InterSystems IRIS or a complete version of Cache/Ensemble?

Service Unavailable error is because of license limitations on TRYCACHE.

0
Vikram Annadurai  Jul 17, 2019 to Eduard Lebedyuk

Hi Eduard,

CROSRestAPI.cls:

Class User.CROSRestAPI Extends %CSP.REST
{
Parameter CHARSET = "utf-8";
Parameter CONTENTTYPE = "application/json";
XData UrlMap [ XMLNamespace = "http://www.intersystems.com/Urlmap]
{
<Routes>
<Map Prefix="user/coffee" Forward="User.CROSRestAPI"/>
<Route Url="/CoffeeMaker" Method="POST" Call="CreateCoffee"/>
<Route Url="/CoffeeMaker:id" Method="PUT" Call="UpdateCoffee"/>
</Routes>
}
ClassMethod CreateCoffee() As %Status
{
CoffeeProp = ##class(User.PropertyName).%New()
CoffeeProp.CoffeeName=%request.Data(CoffeeName)
CoffeeProp.CoffeeColor=%request.Data(CoffeeColor)
CoffeeProp.CoffeePrice=%request.Data(CoffeePrice)
Status = CoffeeProp.%Save()
}
}

And I have a complete version of Cache.

0
David Reche  Jul 17, 2019 to Vikram Annadurai

Review the cconsole.log and check if there is any problem with the license, also you can check Application errors log

0
Vikram Annadurai  Jul 17, 2019 to David Reche

Hi David,

Thanks for ur Comment.

           I have a license problem, That's why I am getting that error.

0
Neerav Verma  Jul 17, 2019 to Vikram Annadurai

Also disable win firewall once you do resolve licence issue

0
Vikram Annadurai  Jul 18, 2019 to Neerav Verma

Thank you Neerav 

I will do it, after i resolve my licence issue...

0
Eduard Lebedyuk  Jul 17, 2019 to Vikram Annadurai

Fixed some issues in REST, but you have license problem.

ClassMethod CreateCoffee() As %Status
{

s json = {}.%FromJSON(%request.Data)
s CoffeeProp = ##class(User.PropertyName).%New()
s CoffeeProp.CoffeeName= json.CoffeeName
s CoffeeProp.CoffeeColor=json.CoffeeColor
s CoffeeProp.CoffeePrice= json.CoffeePrice
s Status = CoffeeProp.%Save()
}
0
Vikram Annadurai  Jul 18, 2019 to Eduard Lebedyuk

Thanks for your support Eduard..

But what to do, I have a licence problem

0
Matthew Giesmann  Aug 15, 2019 to Vikram Annadurai

I haven't tested to see if it matters, but I see that CreateCoffee() isn't returning a %Status. 

0
Vikram Annadurai · Aug 31, 2019

Fairytale bliss!!!

Now I got my expected output..smiley

Solution: I don't have license. But also I can run our Rest API in postman.

         "Our studio should be closed while testing our code on postman"

It is working fine for me angel

Thanks for your Support.

0