Files

46 lines
1.4 KiB
Python
Raw Permalink Normal View History

2022-10-03 18:59:40 -04:00
# 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==")
2022-10-11 09:12:11 -04:00
# Find a page CURL
#curl -u admin:admin -X GET "http://localhost:8080/confluence/rest/api/content?title=myPage%20Title&spaceKey=TST&expand=history" | python -mjson.tool
2022-10-03 18:59:40 -04:00
auth = HTTPBasicAuth("nrasmussen@northpass.com", "qf9Il7X4wkthgQKBOIly5737")
headers = {
"X-Atlassian-Token": "no-check",
"Accept": "application/json",
"Content-Type": "application/json"
}
2022-10-27 17:07:07 -04:00
# Example POST request to https://api.hubspot.com/crm/v3/objects/notes
2022-10-03 18:59:40 -04:00
payload = json.dumps( {
2022-10-27 17:07:07 -04:00
"properties": {
"hs_timestamp": "2021-11-12T15:48:22Z",
"hs_note_body": "Spoke with decision maker Carla. Attached the proposal and draft of contract.",
"hubspot_owner_id": "14240720",
"hs_attachment_ids": "24332474034;24332474044"
}
})
#To associate a note with other CRM records, such as a contact, make a PUT request to /crm/v3/objects/notes/{noteId}/associations/{toObjectType}/{toObjectId}/{associationType}.
2022-10-03 18:59:40 -04:00
response = requests.request(
"POST",
url,
data=payload,
headers=headers,
auth=auth
)
2022-10-10 17:28:58 -04:00
response = json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": "))
print(response)
2022-10-11 09:12:11 -04:00
#x = response.split()
#print(x)
2022-10-10 17:28:58 -04:00