Published on InterSystems Developer Community (https://community.intersystems.com)

Home > REST Beginner Question

Question
Jimmy Christian · Jun 17, 2019

REST Beginner Question

Hello,

I am taking some intro lessons in REST from the online courses. Below is a very simple code i wrote. But when i try to see the output by entering the url

http://localhost:57773/rest/coffeemakerapp/coffeemaker i get an error "

This page isn’t working

If the problem continues, contact the site owner.

HTTP ERROR 401

Thanks,

Jimmy

 Class demo.CoffeeMakerRestServer Extends %CSP.REST
{
XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ]
{
<Routes>
<Route Url="/coffeemaker" Method="GET" Call="GetCoffeeMakerInfo"/>
</Routes>
}

ClassMethod GetCoffeeMakerInfo() As %Status
{
Set tArr=[]
Do tArr.%PUSH({
"img": "txt",
"Name": "Best"
})
Write tArr.%ToJSON() 
Quit $$$OK
}
}

#Beginner #JSON #REST API #Caché

Source URL:https://community.intersystems.com/post/rest-beginner-question