Started the reorganization of Scripts for github. Some notes changes.
This commit is contained in:
45
Scripts/Backup_Notes_Scripts/hubspot_post.py
Normal file
45
Scripts/Backup_Notes_Scripts/hubspot_post.py
Normal file
@ -0,0 +1,45 @@
|
||||
# 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==")
|
||||
# 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
|
||||
|
||||
auth = HTTPBasicAuth("nrasmussen@northpass.com", "qf9Il7X4wkthgQKBOIly5737")
|
||||
|
||||
headers = {
|
||||
"X-Atlassian-Token": "no-check",
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
|
||||
# Example POST request to https://api.hubspot.com/crm/v3/objects/notes
|
||||
payload = json.dumps( {
|
||||
"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}.
|
||||
|
||||
response = requests.request(
|
||||
"POST",
|
||||
url,
|
||||
data=payload,
|
||||
headers=headers,
|
||||
auth=auth
|
||||
)
|
||||
|
||||
response = json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": "))
|
||||
print(response)
|
||||
#x = response.split()
|
||||
#print(x)
|
||||
|
||||
Reference in New Issue
Block a user