40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
# This code sample uses the 'requests' library:
|
|
# http://docs.python-requests.org
|
|
import requests
|
|
from requests.auth import HTTPBasicAuth
|
|
import json
|
|
|
|
url = "https://northpass.atlassian.net/wiki/rest/api/content"
|
|
|
|
#auth = HTTPBasicAuth("bnJhc211c3NlbkBub3J0aHBhc3MuY29tOnFmOUlsN1g0d2t0aGdRS0JPSWx5NTczNw==")
|
|
auth = HTTPBasicAuth("nrasmussen@northpass.com", "qf9Il7X4wkthgQKBOIly5737")
|
|
|
|
headers = {
|
|
"X-Atlassian-Token": "no-check",
|
|
"Accept": "application/json",
|
|
"Content-Type": "application/json"
|
|
}
|
|
|
|
payload = json.dumps( {
|
|
"type":"page",
|
|
"title":"Test Expandable Page",
|
|
"ancestors":[{"id":2210463745}],
|
|
"space":
|
|
{"key":"~350535240"},
|
|
"body":
|
|
{"storage":
|
|
{"value":
|
|
"<p>This is a new page</p> <ac:structured-macro ac:name='expand' ac:schema-version='1'><ac:rich-text-body><p>expandable content goes here</p></ac:rich-text-body></ac:structured-macro>",
|
|
"representation":"storage"}}
|
|
} )
|
|
|
|
response = requests.request(
|
|
"POST",
|
|
url,
|
|
data=payload,
|
|
headers=headers,
|
|
auth=auth
|
|
)
|
|
|
|
print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))
|