在Jenkins REST API中扩展用户模型属性

2024-10-02 00:37:53 发布

您现在位置:Python中文网/ 问答频道 /正文

在查询URL时,我试图使用Jenkins REST API提取用户的最后登录详细信息https://jenkinsurl/user/someusername/api/json 我收到的回复与下面显示的类似

{
      "_class" : "hudson.model.User",
      "absoluteUrl" : "https://jenkinsurl/user/someusername",
      "description" : null,
      "fullName" : "someusername",
      "id" : "someusernameid",
      "property" : [
        {
          "_class" : "someProperty1"
        },
        {
          "_class" : "someProperty2"
        },
        
        {
          "_class" : "org.jenkinsci.plugins.saml.user.LoginDetailsProperty"
        },
      ]
    }

现在,我要查找的详细信息位于LoginDetailsProperty下,可以在source here中找到。当我打开user/someusername/configure修改用户详细信息或创建访问令牌时,我已经看到Jenkins UI中使用了详细信息。如何使用REST API扩展LoginDetailsProperty并提取特定用户的LastLoginItemsTamp值


Tags: 用户httpsrestapijsonurl详细信息class

热门问题