2016-06-28 86 views

回答

3

如果您檢索使用一個項目的細節:GET /project/{projectIdOrKey}你會得到的結果是這樣的:

{ 
    "expand": "description,lead,url,projectKeys", 
    "self": "http://www.example.com/jira/rest/api/2/project/EX", 
    "id": "10000", 
    "key": "EX", 
    "description": "This project was created as an example for REST.", 
    "lead": { 
     "self": "http://www.example.com/jira/rest/api/2/user?username=fred", 
     "name": "fred", 
     "avatarUrls": { 
      "48x48": "http://www.example.com/jira/secure/useravatar?size=large&ownerId=fred", 
      "24x24": "http://www.example.com/jira/secure/useravatar?size=small&ownerId=fred", 
      "16x16": "http://www.example.com/jira/secure/useravatar?size=xsmall&ownerId=fred", 
      "32x32": "http://www.example.com/jira/secure/useravatar?size=medium&ownerId=fred" 
     }, 
     "displayName": "Fred F. User", 
     "active": false 
    }, 

    ... 

    "avatarUrls": { 
     "48x48": "http://www.example.com/jira/secure/projectavatar?size=large&pid=10000", 
     "24x24": "http://www.example.com/jira/secure/projectavatar?size=small&pid=10000", 
     "16x16": "http://www.example.com/jira/secure/projectavatar?size=xsmall&pid=10000", 
     "32x32": "http://www.example.com/jira/secure/projectavatar?size=medium&pid=10000" 
    }, 
    "projectCategory": { 
     "self": "http://www.example.com/jira/rest/api/2/projectCategory/10000", 
     "id": "10000", 
     "name": "FIRST", 
     "description": "First Project Category" 
    } 
} 

avatarUrls部分提到的網址,在diferent分辨率項目圖標。

請注意,還有一個avatarUrls部分根據導致。這提到了項目主管化身的URL。

+0

謝謝, 我得到了項目頭像使用下面的API。 /rest/api/2/project/{ProjectKey}/ –

+1

此網址將在瀏覽器中運行,但在代碼中,我們需要使用GET請求下載圖像數據,然後將數據轉換爲圖像。我們無法將此圖片網址分配給imageView,因爲這不是精確的圖片網址。 –

+1

如果我們有projectId(pid),那麼我們也可以在下面的url中替換pid的值來獲得頭像。 http://www.example.com/jira/secure/projectavatar?pid=10000 –