Error requesting /resources.json apiEndpoint in JSON format (v. 2.36.7) [fixed]

Hi there all!

Question: what happened to the /api/resources.json?
And in general is it possible to get the list of actual API points with full descriptions?

Thank you.
Regards,
Ulanbek

HI @Ulanbek (:

Are you able to access /api/resources,json? I’m able to access it on play.dhis2.org/2.37.2, see image:

Using /api/schemas you’ll be able to view list of all metadata apiEndpoints and more info about the metadata properties. [your-instance-url]/api/schemas
And from the API documentation (Using the API - Introduction - DHIS2 Documentation) you’ll find more details about using these apiEndpoints, filters, explanation with examples…etc

Hope this helps. Thank you!

Best,
Al-Gassim

2 Likes

Hi @Ulanbek, If you mean something like an OpenAPI (Swagger) spec, that is something we have looked at in the past. The DHIS2 API is very large and complex and it’s not trivial to generate a full OpenAPI spec. However, I’m hopeful that we can generate a spec for parts of the API (starting with the metadata endpoints) in the not-too-distant future.

1 Like

Hi @Gassim

Thank you for your quick reply. Currently I am using 2.36.6 and when I tried to get an access to the api/resources.json I got an error

Moreover as you pointed [[your-instance-url]/api/schemas] I couldn’t find any Instance_URL/api/resources.json ApiEndPoint, although the ApiEndPoint exists in XML format Instance_URL/api/resources. So it seems this end point was removed or it must have some parameters to be passed to get resources list in JSON format.

Any ideas?
Thank you
Best, Ulanbek

Hi @phil,

Thank you for your reply. Actually I was wondering to get at least list of existing ApiEndpoints, not that deep as you mentioned. Although it will be useful for the future development as well. So will patiently wait that not-too-distant future :slight_smile:

Thank you @phil

Regards,
Ulanbek

I opened this ticket about an updated OpenAPI Spec (which can be imported to Postman) here: Log in - DHIS 2 JIRA. It is currently in “planned” status.

2 Likes

Cool @chase.freeman !

Thanks!

1 Like

@Gassim , could you check this one DHIS 2 Demo - Sierra Leone
You will get error

2 Likes

It seems the JSON response is causing the error. The Default XML response at the /resources endpoint is working (Play -2.36.7)

1 Like

XML endpoint works - no problems there. But for me more convenient to get results in json format.
Either this is bug, or something wrong internally.

2 Likes

Indeed. I agree with you and it is likely a bug.

1 Like

I agree, it seems to be a bug on 2.36. We will raise an issue.

(P.S. This is probably the wrong thread for discussing issues with 2.36, though! :wink: )

1 Like

@phil I do agree this is wrong place to discuss but we have found the bug :slight_smile:

1 Like

Thanks @Ulanbek, @chase.freeman, and @jaime.bosque ! I’ve moved the discussion to a new topic thread.

@Ulanbek would you like to create a bug issue in jira.dhis2.org please? Thank you! (:

@Ulanbek ,
Have you tried to use the format=json instead of the .json ?
I tried this https://play.dhis2.org/2.36.7/api/resources?format=json and I get the results

2 Likes

Thank you @kose for your reply. Yes I know it, but would be more shorter and convenient when you can write direcly api/resources.json

Regards, Ulanbek

@Kose thanks! I forgot completely we could do that… As @Ulanbek we could still create a jira bug issue, would you like me to do it on your behalf? Thanks!

Dear @Gassim,
Thanks for your support and help. Yes, please create the bug report.
Thanks again
Regards, Ulanbek

Is there a bug report for this already?

Thanks for the reminder @german! (:

@here here’s the Jira issue, you can ‘watch’ to receive email updates, and you can add your vote to the issue:

DHIS2-12591 # API resources.json endpoint error v. 2.36.7

Update: @here the issue has been fixed:

Thanks!

1 Like