How can i create Confluence page with labels right at the creating page moment?
Asked by Pavel Shakhov:

I use template page content when creating new one.

In request to page creating also used label metadata:

\`\`\`

"metadata": { "labels": { "results": \[ { "prefix": "global", "name": "onboarding-in-progress", "id": "1428160516" } \], "start": 0, "limit": 200, "size": 1, "_links": { "self": "<https://confluence.our.ru/rest/api/content/1423147802/label>" } }, "_expandable": { "currentuser": "", "properties": "", "frontend": "", "editorHtml": "" } }

\`\`\`

But new page created without label.

Can i do this without additional calling PUT /label?


Answers:
author: Patrick Vanhoof
body: Not sure what you are trying to do, but if in Confluence you are using templates to create pages, you can add the necessary labels to the template.

comments: author: Pavel Shakhov
body: When i used request like this a don\`t have label on page, but its persists in request metadata:

```
{
  "type": "page",
  "status": "current",
  "title": "Test Onboarding Java",
  "space": {
    "id": 608403466,
    "key": "OUR",
    "name": "TOUR Origination Platform",
    "type": "global",
    "_links": {
      "webui": "/display/OUR",
      "self": "https://confluence.our.ua/rest/api/space/OUR"
    },
    "_expandable": {
      "metadata": "",
      "icon": "",
      "description": "",
      "homepage": "/rest/api/content/610894728"
    }
  },
  "ancestors": [
    {
      "id": "607485723",
      "type": "page",
      "status": "current",
      "title": "OUR",
      "extensions": {
        "position": "none"
      },
      "_links": {
        "webui": "/display/OUR/OUR",
        "edit": "/pages/resumedraft.action?draftId=607485723",
        "tinyui": "/x/G381J",
        "self": "https://confluence.our.ua/rest/api/content/607485723"
      },
      "_expandable": {
        "container": "/rest/api/space/OUR",
        "metadata": "",
        "operations": "",
        "children": "/rest/api/content/607485723/child",
        "restrictions": "/rest/api/content/607485723/restriction/byOperation",
        "history": "/rest/api/content/607485723/history",
        "ancestors": "",
        "body": "",
        "version": "",
        "descendants": "/rest/api/content/607485723/descendant",
        "space": "/rest/api/space/OUR"
      }
    },
    {
      "id": "610894728",
      "type": "page",
      "status": "current",
      "title": "TOUR Origination Platform",
      "extensions": {
        "position": "none"
      },
      "_links": {
        "webui": "/display/OUR/TOUR+Origination+Platform",
        "edit": "/pages/resumedraft.action?draftId=610894728&draftShareId=df7eb7da-c008-4071-b288-1ab059764df1",
        "tinyui": "/x/iINpJ",
        "self": "https://confluence.our.ua/rest/api/content/610894728"
      },
      "_expandable": {
        "container": "/rest/api/space/OUR",
        "metadata": "",
        "operations": "",
        "children": "/rest/api/content/610894728/child",
        "restrictions": "/rest/api/content/610894728/restriction/byOperation",
        "history": "/rest/api/content/610894728/history",
        "ancestors": "",
        "body": "",
        "version": "",
        "descendants": "/rest/api/content/610894728/descendant",
        "space": "/rest/api/space/OUR"
      }
    },
    {
      "id": "919730326",
      "type": "page",
      "status": "current",
      "title": "OUR. ??????????????",
      "extensions": {
        "position": 10
      },
      "_links": {
        "webui": "/pages/viewpage.action?pageId=919730326",
        "edit": "/pages/resumedraft.action?draftId=919730326&draftShareId=33443bda-0ceb-44c3-9fc7-9a06f7c7a60e",
        "tinyui": "/x/lvjRNg",
        "self": "https://confluence.our.ua/rest/api/content/919730326"
      },
      "_expandable": {
        "container": "/rest/api/space/OUR",
        "metadata": "",
        "operations": "",
        "children": "/rest/api/content/919730326/child",
        "restrictions": "/rest/api/content/919730326/restriction/byOperation",
        "history": "/rest/api/content/919730326/history",
        "ancestors": "",
        "body": "",
        "version": "",
        "descendants": "/rest/api/content/919730326/descendant",
        "space": "/rest/api/space/OUR"
      }
    },
    {
      "id": "1046402710",
      "type": "page",
      "status": "current",
      "title": "Infra - ???? ???????",
      "extensions": {
        "position": "none"
      },
      "_links": {
        "webui": "/pages/viewpage.action?pageId=1046402710",
        "edit": "/pages/resumedraft.action?draftId=1046402710&draftShareId=f0cb8695-2df9-402d-abde-9ece336a7a85",
        "tinyui": "/x/ltZePg",
        "self": "https://confluence.our.ua/rest/api/content/1046402710"
      },
      "_expandable": {
        "container": "/rest/api/space/OUR",
        "metadata": "",
        "operations": "",
        "children": "/rest/api/content/1046402710/child",
        "restrictions": "/rest/api/content/1046402710/restriction/byOperation",
        "history": "/rest/api/content/1046402710/history",
        "ancestors": "",
        "body": "",
        "version": "",
        "descendants": "/rest/api/content/1046402710/descendant",
        "space": "/rest/api/space/OUR"
      }
    },
    {
      "id": "1087876627",
      "type": "page",
      "status": "current",
      "title": "OUR-ci ??",
      "extensions": {
        "position": "none"
      },
      "_links": {
        "webui": "/pages/viewpage.action?pageId=1087876627",
        "edit": "/pages/resumedraft.action?draftId=1087876627&draftShareId=d48464bb-f102-416d-ba7b-04fde4ddffc2",
        "tinyui": "/x/E67XQ",
        "self": "https://confluence.our.ua/rest/api/content/1087876627"
      },
      "_expandable": {
        "container": "/rest/api/space/OUR",
        "metadata": "",
        "operations": "",
        "children": "/rest/api/content/1087876627/child",
        "restrictions": "/rest/api/content/1087876627/restriction/byOperation",
        "history": "/rest/api/content/1087876627/history",
        "ancestors": "",
        "body": "",
        "version": "",
        "descendants": "/rest/api/content/1087876627/descendant",
        "space": "/rest/api/space/OUR"
      }
    }
  ],
  "body": {
    "storage": {
      "value": "custom content", 
      "representation": "storage",
      "_expandable": {
        "content": "/rest/api/content/1423147802"
      }
    },
    "_expandable": {
      "editor": "",
      "view": "",
      "export_view": "",
      "styled_view": "",
      "anonymous_export_view": ""
    }
  },
  "metadata": {
    "labels": {
      "results": [
        {
          "prefix": "global",
          "name": "onboarding-in-progress",
          "id": "1428160516"
        }
      ],
      "start": 0,
      "limit": 200,
      "size": 1,
      "_links": {
        "self": "https://confluence.our.ua/rest/api/content/1423147802/label"
      }
    },
    "_expandable": {
      "currentuser": "",
      "properties": "",
      "frontend": "",
      "editorHtml": ""
    }
  },
  "extensions": {
    "position": 5
  },
  "_links": {
    "webui": "/display/OUR/%7BCandidateName%7D+Onboarding+Java",
    "edit": "/pages/resumedraft.action?draftId=1423147802&draftShareId=30c604c9-f92b-4239-af0e-6ebcd0b458bd",
    "tinyui": "/x/GoPTV",
    "collection": "/rest/api/content",
    "base": "https://confluence.our.ua",
    "context": "",
    "self": "https://confluence.our.ua/rest/api/content/1423147802"
  },
  "_expandable": {
    "container": "/rest/api/space/OUR",
    "operations": "",
    "children": "/rest/api/content/1423147802/child",
    "restrictions": "/rest/api/content/1423147802/restriction/byOperation",
    "history": "/rest/api/content/1423147802/history",
    "version": "",
    "descendants": "/rest/api/content/1423147802/descendant"
  }
}
 
```


Tags: rest-api