[ https://issues.apache.org/jira/browse/HADOOP-13628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15510857#comment-15510857 ]
Weiwei Yang commented on HADOOP-13628: -------------------------------------- v3 patch has following updates * Supported both JSON and XML format of response * Added some tests in {{TestConfServlet#testGetProperty}}, use some mockups to test the API * Query for a non-exist configuration property will get a 404 error now * Extracted some common code in {{Configuration}} for reuse, such as {{Configuration#appendXMLProperty}} and {{Configuration#appendJSONProperty}} * Improved java doc Some more explanation to the behaviors. When you want to query for a property, issue following command {code} curl --header "accept: application/xml" http://deale1.fyre.ibm.com:8088/conf?name=yarn.ipc.rpc.class Output: <property><name>yarn.ipc.rpc.class</name><value>org.apache.hadoop.yarn.ipc.HadoopYarnProtoRPC</value><final>false</final><source>yarn-default.xml</source></property> {code} if you want to get a json output, just modify the header {code} curl --header "accept: application/json" http://deale1.fyre.ibm.com:8088/conf?name=yarn.ipc.rpc.class Output: {"property":{"key":"yarn.ipc.rpc.class","value":"org.apache.hadoop.yarn.ipc.HadoopYarnProtoRPC","isFinal":false,"resource":"yarn-default.xml"}} {code} if you provided a non-exist property name {code} curl --header "accept: application/xml" http://deale1.fyre.ibm.com:8088/conf?name=unknown.property Output: ... <title>Error 404 Property unknown.property not found</title> </head> <body><h2>HTTP ERROR 404</h2> <p>Problem accessing /conf. Reason: <pre> Property unknown.property not found</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/> <br/> {code} if you did not provide any value to {{name}} parameter, or did not use it, it behaves just like before, dump all configuration properties. So following commands will get same output {code} curl --header "accept: application/xml" http://deale1.fyre.ibm.com:8088/conf?name="" curl --header "accept: application/xml" http://deale1.fyre.ibm.com:8088/conf?name= curl --header "accept: application/xml" http://deale1.fyre.ibm.com:8088/conf Output: All properties... {code} > Support to retrieve specific property from configuration via REST API > --------------------------------------------------------------------- > > Key: HADOOP-13628 > URL: https://issues.apache.org/jira/browse/HADOOP-13628 > Project: Hadoop Common > Issue Type: Improvement > Components: conf > Affects Versions: 2.7.3 > Reporter: Weiwei Yang > Assignee: Weiwei Yang > Attachments: HADOOP-13628.01.patch, HADOOP-13628.02.patch, > HADOOP-13628.03.patch > > > Currently we can use rest API to retrieve all configuration properties per > daemon, but unable to get a specific property by name. This causes extra > parse work at client side when dealing with Hadoop configurations, and also > it's quite over head to send all configuration in a http response over > network. Propose to support following a {{name}} parameter in the http > request, by issuing > {code} > curl --header "Accept:application/json" > http://${RM_HOST}/conf?name=yarn.nodemanager.aux-services > {code} > get output > {code} > {"property"{"key":"yarn.resourcemanager.hostname","value":"${RM_HOST}","isFinal":false,"resource":"yarn-site.xml"}} > {code} > This change is fully backwards compatible. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org