· Jun 18, 2020

Getting error when using getJSON method in %Net.Http

Running Cache 2017.2.2.

I'm trying to make a REST API call in JSON format. When using the example in the class reference documentation the getJSON method in the %Net.Http class throws the error  <METHOD DOES NOT EXIST> on a %Clone() method in the %LIbrary.DynamicObject class. I even changed the parameter to a JSON string to no avail. The  code will then fail on the %Compose method (examples below). My workaround is to use the %Net.HttpRequest functionality. Is there another workaround to this?


Example As Is:

USER>set continents = ##class(%Net.Http).getJSON("http://localhost:57772/api/document/v1/SAMPLES/continents",{"Username":"_SYSTEM","Password":"SYS"}

<METHOD DOES NOT EXIST>zgetJSON+12^%Net.Http.1 *%Clone,%Library.DynamicObject

Example with a JSON string:

USER>set continents = ##class(%Net.Http).getJSON("http://localhost:57772/api/document/v1/SAMPLES/continents",{"Username":"_SYSTEM","Password":"SYS"}.%ToJSON())

<METHOD DOES NOT EXIST>zgetJSON+43^%Net.Http.1 *%Compose,%Library.DynamicObject

Discussion (2)0
Log in or sign up to continue