Starting with the REST API

Hello,

I’m trying to research datagerry to see if it’s suitable for for us. Though I’m blocked on the REST API trying to query out objects.

Though I can’t find the URL or path to query. I’ve read this several times: https://docs.datagerry.com/latest/api/rest/index.html but it dose not explain what “module” is or how to query an object.

Is there a howto or example for using the REST API ?

Thanks
J

Hi @Jeremy
i think You can use:
curl -s -u user:password https://eewid.gkpge.pl/rest/object/ - show all objects
curl -s -u user:password https://eewid.gkpge.pl/rest/object/1 - show object with id 1
if use “type” instead of “object” you could show types

Hello @marcinw that is what I was looking for, thank you. :grinning:

@Jeremy
No problem, i knowed so i wrote it :slight_smile:

Hi all

Is there a way i can get objects of a specific type through an API call?
As to then get the desired object ID?

Thank you
Best Regards
Konstantinos Betsis

Hi @kbetsis,

you can use the following REST call to get all objects of a specific type:

curl -u user:password http://127.0.0.1:4000/rest/object/type/<typeID>

An other option is to use the Exportd ExternalSystemGenericPullJson plugin (long word :slight_smile: ). With that, you can define a JSON output with a custom structure.

Hi @mbatz

Happy new year with lots of wishes for health, happiness and everything you wish for you, your family and colleagues.

I am trying to create some custom endpoint, as mentioned above “ExternalSystemGenericPullJson”, as to enable a more “user friendly” API for users to get the necessary information.

I have successfully created two API calls, one for objects type A and one for objects type B.
Type B has a parent relationship with Type A, like branches with routers.

So in theory one would be able to GET all branches through an API call and by selecting the desired branch_id = branches object_id he could use it to get all routers attached to that branch.

However, when I issue the second API and put as a query parameter the branch_id i still get all type B results without any filtering.

How, can I filter the results of JSON pull through the value of one variable and only get all results that have the requested variable included?

Thank you

Hi,

Did something change? If I do /rest/object/ I just get told that the method is not allowed. I’m just trying to list alle objects - no matter of the type they have.

curl -u username:password http://xxx.yyy.com:4000/rest/object/
{“description”:“The method is not allowed for the requested URL.”,“joke”:“to not be able to do something for toffee/nuts.”,“message”:"",“response”:“Method Not Allowed: http://xxx.yyy.com:4000/rest/object/","status”:405}

Using version 1.5.2.

Regards
Morten

I can answer my own questions. The URL is /rest/objects/ and not /rest/object/ as mentioned above. Cant say if it’s a change or allways have been with the “S”.