Question
· 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

Discussion (12)3
Log in or sign up to continue

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.