4- Attachment like images with GET and POST

1- For the "site header's LOGO" only one attachment under the home page of the SPACE

2- for all other images, attached to the page

3- in the HTML must referrer to the attachment


Documentation:   https://developer.atlassian.com/cloud/confluence/rest/#api-content-id-child-attachment-post

Best document:  https://docs.atlassian.com/atlassian-confluence/REST/6.5.2/?_ga=2.77528533.1516931135.1540774221-392665659.1538899673#content/{id}/child/attachment-createAttachments


https://docs.atlassian.com/ConfluenceServer/rest/6.7.2/


With postman: GET attachment of a page:

GET "https://thefreetelecomuni.atlassian.net/wiki/rest/api/content/111575100/descendant/attachment"




1- get the homepage "content id"

"GET Space"

GET https://thefreetelecomuni.atlassian.net/wiki/rest/api/space/TEST/

>>>>>      homepage: "/rest/api/content/164855963"

2- use this id to get the attachment id

"GET Attachment"

GET https://thefreetelecomuni.atlassian.net/wiki/rest/api/content/164855963

GET  https://thefreetelecomuni.atlassian.net/wiki/rest/api/content/164855963/descendant/attachment

>>>>>>   id: "att164757511", 

>>>>>>  title: "headerFTU.jpg",

>>>>> _links:  self: "https://thefreetelecomuni.atlassian.net/wiki/rest/api/content/att164757511",

3- use the link to get attachment info

GET:   https://thefreetelecomuni.atlassian.net/wiki/rest/api/content/att164757511


>>>> _links to the image:

base: "https://thefreetelecomuni.atlassian.net/wiki"

webui: "/spaces/TEST/overview?preview=%2F164855963%2F164757511%2FheaderFTU.jpg",


Success

GET https://thefreetelecomuni.atlassian.net/wiki/rest/api/content/164855963/descendant/attachment

GET attachment
{
    "results": [
        {
            "id": "att111215621",
            "type": "attachment",
            "status": "current",
            "title": "headerFTU.jpg",
            "macroRenderedOutput": {},
            "metadata": {
                "mediaType": "image/jpeg"
            },
            "extensions": {
                "mediaType": "image/jpeg",
                "fileSize": 41386,
                "comment": "",
                "mediaTypeDescription": "JPEG Image",
                "fileId": "4e52b601-f013-4cff-96f8-4c963709032f",
                "collectionName": "contentId-111575100"
            },
            "_expandable": {
                "childTypes": "",
                "container": "/rest/api/content/111575100",
                "operations": "",
                "children": "/rest/api/content/att111215621/child",
                "restrictions": "/rest/api/content/att111215621/restriction/byOperation",
                "history": "/rest/api/content/att111215621/history",
                "ancestors": "",
                "body": "",
                "version": "",
                "descendants": "/rest/api/content/att111215621/descendant",
                "space": "/rest/api/space/TEST"
            },
            "_links": {
                "webui": "/spaces/TEST/pages/111575100/IT?preview=%2F111575100%2F111215621%2FheaderFTU.jpg",
                "self": "https://thefreetelecomuni.atlassian.net/wiki/rest/api/content/att111215621",
                "download": "/download/attachments/111575100/headerFTU.jpg?version=1&modificationDate=1557693550410&cacheVersion=1&api=v2"
            }
        }
    ],
    "start": 0,
    "limit": 25,
    "size": 1,
    "_links": {
        "base": "https://thefreetelecomuni.atlassian.net/wiki",
        "context": "/wiki",
        "self": "https://thefreetelecomuni.atlassian.net/wiki/rest/api/content/111575100/descendant/attachment"
    }
}
Faile
GET no attachment
{
    "results": [],  <<<<<<<<<<<<<<< no Result !!!   =  no Attachment >>>>>>>>>>>>
    "start": 0,
    "limit": 25,
    "size": 0,
    "_links": {
        "base": "https://thefreetelecomuni.atlassian.net/wiki",
        "context": "/wiki",
        "self": "https://thefreetelecomuni.atlassian.net/wiki/rest/api/content/111411266/descendant/attachment"
    }
}