How to get the API Token for Jenkins

前端 未结 3 1427
青春惊慌失措
青春惊慌失措 2020-12-02 12:43

I am trying to use the jenkins rest api. In the instructions it says I need to have the api key. I have looked all over the configuration pages to find it. How do i get the

3条回答
  •  情话喂你
    2020-12-02 13:25

    The non UI way to do this post Jenkins 2.129 is:

    curl 'https:///me/descriptorByName/jenkins.security.ApiTokenProperty/generateNewToken' \
    --data 'newTokenName=foo' \
    --user username:Password
    

    which returns:

    {
      "status": "ok",
      "data": {
        "tokenName": "foo",
        "tokenUuid": "",
        "tokenValue": ""
      }
    }
    

    Pre Jenkins 2.129

    curl http://:@/me/configure 
    

提交回复
热议问题