如何获取YQL中的响应字段列表

时间:2012-12-19 18:27:10

标签: yql

给出表答案.getquestion;我的印象是“desc answers.getquestion”会提供查询answers.getquestion的所有可能响应字段的列表。相反,它提到question_id是必填字段。

在哪里/如何在响应字段下获得http://developer.yahoo.com/answers/V1/getQuestion.html中提到的列表?另外,在哪里可以看到标识请求中的question_id的映射是否为响应中的id?

1 个答案:

答案 0 :(得分:1)

在YQL中,“desc”命令给出了表的简短摘要(参考:YQL docs)。在您的示例中,请求desc answers.getquestion显示有关此表的一些简单信息:

<table hash="2143dbc888c9ccf3daac6778d0f57a32"
    name="answers.getquestion" security="ANY">
    <meta>
        <author>James Broad</author>
        <documentationURL>http://developer.yahoo.com/answers/V1/getQuestion.html</documentationURL>
        <sampleQuery>select * from answers.getquestion where question_id="20090526102023AAkRbch"</sampleQuery>
    </meta>
    <request>
        <select>
            <key name="appid" private="true" type="xs:string"/>
            <key name="question_id" required="true" type="xs:string"/>
        </select>
    </request>
</table>

关于响应字段的问题,它们将直接来自Yahoo!答案Get Question API call。 YQL表只是底层API的包装器,因此结果将简单地通过YQL返回。

例如,您可以在YQL控制台中查看select * from answers.getquestion where question_id="1005120800412"的结果:

<Question xmlns="urn:yahoo:answers" id="1005120800412" type="Answered">
    <Subject>Why is there no TITLE tag in the header of answers.yahoo.com?</Subject>
    <Content>Come on, you guys.  It's not valid HTML if there's no title. :) Correction: there's no TITLE tag in any of the edit screens, including the one I'm using to add these details. Sorry, my bad.</Content>
    <Date>2005-12-08 08:22:33</Date>
    <Timestamp>1134058953</Timestamp>
    etc.
</Question>