API response content type - JSON vs. XML


#1

Hello,

I am running Nexus Repository ManagerOSS 3.12.0-01 on my machine. I want to have a Python script to obtain info on a given asset using the API. So far, I have been able to accomplish that using the urllib functions. The problem is, I can only seem to get JSON response.

Even if I goto the API section under the Nexus web interface, the “Response content type” only has “application/json” as an available option.

If I change my url request to have the header define “Content-Type” as “application/xml”, it will result in an HTTP Error with Unsupported Media Type. Does the Nexus API no longer support XML response content anymore? Or am I missing some configuration?

Ingrid


#2

Nexus Repo 2.x supported both XML and JSON for REST API responses. Nexus Repo 3.x only supports JSON. That shouldn’t be a problem for python, it has very good support for JSON:

https://docs.python.org/3/library/json.html

Regards,

Rich


#3

Well, that cleared things up. Thanks for the tip.