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
Hi Vikram,
Have you checked if you have granted privileges?

Best regards,
Francisco Lopez
Hi Francis,
Yeah I added that. Then also I getting that same error.
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.
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
{
s CoffeeProp = ##class(User.PropertyName).%New()
s CoffeeProp.CoffeeName=%request.Data(CoffeeName)
s CoffeeProp.CoffeeColor=%request.Data(CoffeeColor)
s CoffeeProp.CoffeePrice=%request.Data(CoffeePrice)
s Status = CoffeeProp.%Save()
}
}
And I have a complete version of Cache.
Review the cconsole.log and check if there is any problem with the license, also you can check Application errors log
Hi David,
Thanks for ur Comment.
I have a license problem, That's why I am getting that error.
Also disable win firewall once you do resolve licence issue
Thank you Neerav
I will do it, after i resolve my licence issue...
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()
}Thanks for your support Eduard..
But what to do, I have a licence problem
I haven't tested to see if it matters, but I see that CreateCoffee() isn't returning a %Status.
Fairytale bliss!!!
Now I got my expected output..![]()
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 ![]()
Thanks for your Support.
