Skip to content

Commit

Permalink
feat(Pipedrive): Add Add an organization
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorentLvr committed Dec 22, 2023
1 parent 2ae67da commit 23149e6
Showing 1 changed file with 252 additions and 0 deletions.
252 changes: 252 additions & 0 deletions Pipedrive/Pipedrive_Add_an_organization.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "9aca2dbb-432c-4b38-b712-185505836ec4",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"<img width=\"8%\" alt=\"Naas.png\" src=\"https://raw.githubusercontent.com/jupyter-naas/awesome-notebooks/master/.github/assets/logos/Naas.png\" style=\"border-radius: 15%\">"
]
},
{
"cell_type": "markdown",
"id": "c2297c6c-1c56-44f5-ab1b-4f358315ae4d",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"# Pipedrive - Add an organization"
]
},
{
"cell_type": "markdown",
"id": "1528c23e-d4b5-4dae-aedd-3e0c3de7a07e",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Tags:** #pipedrive #organization #add #api #v1 #python"
]
},
{
"cell_type": "markdown",
"id": "0f5b4999-cf8f-429b-a3b5-60abd6f0b4cb",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Author:** [Florent Ravenel](https://www.linkedin.com/in/florent-ravenel/)"
]
},
{
"cell_type": "markdown",
"id": "b50cf866-b0f5-45c1-9ea2-4c63d5622675",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Last update:** 2023-12-22 (Created: 2023-12-22)"
]
},
{
"cell_type": "markdown",
"id": "da21ae20-d8f3-41ae-b6e4-1d16e8bca2d0",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Description:** This notebook adds a new organization to Pipedrive. It uses the Pipedrive API v1 to do so."
]
},
{
"cell_type": "markdown",
"id": "6a0004b2-eb12-4dc2-b721-6b482cab7439",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**References:**\n- [Pipedrive API v1 Documentation](https://developers.pipedrive.com/docs/api/v1/Organizations#addOrganization)\n- [Pipedrive API Authentication](https://developers.pipedrive.com/docs/api/authentication)"
]
},
{
"cell_type": "markdown",
"id": "906e7461-ec7c-4efe-952b-79a2fcdf2b94",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"## Input"
]
},
{
"cell_type": "markdown",
"id": "699c6ed8-1d1c-4712-b64c-34ed8b385130",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Import libraries"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "771e3ddd-f295-4b44-a7d5-0873ee5be72a",
"metadata": {
"papermill": {},
"tags": []
},
"source": "import requests\nimport json",
"outputs": []
},
{
"cell_type": "markdown",
"id": "0ab0d130-cbec-438c-a188-8a0cb295da4e",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Setup variables\n- `api_token`: API token used to authenticate the request. [Get your API token](https://developers.pipedrive.com/docs/api/authentication).\n- `name`: Name of the organization to add."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d6ffb591-6b88-43f6-95b7-a93de4040366",
"metadata": {
"papermill": {},
"tags": []
},
"source": "api_token = \"YOUR_API_TOKEN\"\nname = \"My Organization\"",
"outputs": []
},
{
"cell_type": "markdown",
"id": "61a6835b-4526-4d1e-9e21-e2c9325f0206",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"## Model"
]
},
{
"cell_type": "markdown",
"id": "ca89baa8-b76c-4f9e-8d60-74fdfacf141d",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Add organization"
]
},
{
"cell_type": "markdown",
"id": "be8d272a-e789-4fe1-a47d-625271bc2c13",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"This function adds a new organization to Pipedrive."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4e6814d5-bfeb-413a-a4e9-7d9c70c4d95b",
"metadata": {
"papermill": {},
"tags": []
},
"source": "def add_organization(api_token, name):\n url = \"https://api.pipedrive.com/v1/organizations\"\n headers = {\"Authorization\": \"Bearer \" + api_token}\n data = {\"name\": name}\n response = requests.post(url, headers=headers, data=data)\n return response.json()",
"outputs": []
},
{
"cell_type": "markdown",
"id": "7c89f6ac-4231-46ea-81ba-3aa90bc46f3c",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"## Output"
]
},
{
"cell_type": "markdown",
"id": "c717952a-a404-43b8-91e7-abdacfdb6d65",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Display result"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "10d83ed6-c8c7-4ba6-99c3-d55b04ad33c7",
"metadata": {
"papermill": {},
"tags": []
},
"source": "result = add_organization(api_token, name)\nprint(json.dumps(result, indent=2))",
"outputs": []
},
{
"cell_type": "markdown",
"id": "5e625e87-9a42-44a4-a872-9ab557638886",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
" "
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"state": {},
"version_major": 2,
"version_minor": 0
}
}
},
"nbformat": 4,
"nbformat_minor": 5
}

0 comments on commit 23149e6

Please sign in to comment.