# README #
This library makes it easy to set up a Netsuite authorization without needing a frontend client using CLI utilities.
### Docs ###
[Netsuite API Documentation](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_158022624537.html)
## What do I need to get set up? ##
* Run `pip install netsuite-python`
* Activate your python VENV
* If using virtual environment
* Activate your virtual environment
* `netsuite = python venv/bin/keap`
# QUICK START #
## Prerequisite Setup ##
1. Enable Services
* Restlets
* Rest Web Services
* OAUTH 2.0
2. Create a role for the integration with the following permissions:
* Access Token Management
* Log in using Access Tokens
* Log in using OAuth 2.0 Access Tokens
* OAuth 2.0 Authorized Applications Management
* REST Web Services
* SuiteApp Deployment
* SuiteScript
* User Access Tokens
3. Create an integration record
* Check Client Credentials ( MAchine to Machine Grant)
* Under Scope Select
* Restlets
* Rest Web Services
* STORE THE CLIENT ID
4. Create and upload the certificate
* with dev environment setup, run ```netsuite generate-certificate```
* upload the public cert to Netsuite under Setup -> Integrations -> Manage Oauth 2.0
## Setup The Easy Way ##
run ``` netsuite initialize ```
* Follow the prompts
* Docs will be located in the generated "netsuite_rest_client folder" at the rot of the project
#### Usage ####
```python
# import Netsuite Package
from netsuite import Netsuite
# import the generated Client
from netsuite_rest_client import apis, rest_api_client
# import models
from netsuite_rest_client.model.customer import Customer
# instantiate the SDK
netsuite = Netsuite()
# Instantiate the generated Client
rest_client = rest_api_client.RestApiClient(netsuite)
# Instantiate the generated API endpoints using the generated client
customer_api = apis.CustomerApi(rest_client)
```
#### Notes ####
* Requirements
* Sandbox requires the same setup as Prod, it DOES NOT copy over
* An administrator for the Netsuite app to follow the steps [here](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_157771281570.html)
* A user with the correct role
* A role with the correct permissions
* An Integration Record with the correct permissions (ensure default form is set correctly)
* Client ID and Secret comes from this step, ensure they provide these
* Certificate ID
* A Certificate can be generated once you register the package with CLI with 'netsuite generate-certificate'
* Cert ID is available under Setup -> Integration -> OAuth 2.0 Client Credentials once the certificate is uploaded.
## Use Restlets ##
saved search example ref: https://timdietrich.me/blog/netsuite-saved-search-api/
```python
# import restlet client
restlet_client = netsuite.RESTLET_CLIENT.restlet_api
# create body params
body_params = {"searchID": 'customsearch184275'}
# call restlet
print(restlet_client.execute_restlet(script=1999, deploy=1, body_params=body))
```
## Regenerating the API Client with more records types
re-run ```netsuite generate-rest-client```
* when asked about using more record types, choose option that lets you set them
* pick record types from the list
* complete prompts
## Uploading x509 certificate to Netsuite ##
* On Client's Netsuite top ribbon go to `Setup -> Integration -> OAuth 2.0 Client Credentials`
* Click `Create-New` button
* Entity: The User created for TAG
* ROLE: Role created for this integration
* Application: Application Created for this integration
* Certificate: Click "Choose A File" and upload the PUBLIC Cert (called netsuite-certificate.pem by default)
* Copy the Certificate ID
# Other Commands #
## Generating x509 certificate for Netsuite ###
* Run `netsuite generate-certificate`
* Domain: theapiguys.com
* Organization: TAG
* Department: DEV
* City: BOSTON
* State: MA
* Country: US
* Email: will@theapiguys.com
* It will store the cert in a file in the root of the project under config/netsuite
## Setting up Netsuite SDK in a project ##
* Run `netsuite generate-client-config`
* It will ask you for information obtained above: You can use all the defaults
* Client ID
* Netsuite Certificate ID
* Netsuite Key File
* Netsuite Application Name
* Storage Class
* If you want to save to file
* Provide a valid path for netsuite-credentials.json
* else the credentials will be echoed out
* To confirm, check the netsuite credentials path you entered, or the default, and there should be a json file with all
the info you entered. Verify the details.
## Getting The Access Token ##
* Run `$netsuite get-access-token`
* Use the defaults or repeat the info used above for
* Path to Netsuite Credentials
* Confirm the app name to be refreshed, if single app, just use default
* That's it! You should now have a valid token to use with the Netsuite API.
Raw data
{
"_id": null,
"home_page": "https://github.com/codinlikewilly/netsuite_python",
"name": "netsuite-python",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Will @ TheAPIGuys",
"author_email": "will@theapiguys.com",
"download_url": "https://files.pythonhosted.org/packages/cc/bd/6acb806206c427b3322db7cf694bff64ec8cdc166595cffeb16662e4b15e/netsuite_python-1.6.4.tar.gz",
"platform": null,
"description": "# README #\r\n\r\n\r\nThis library makes it easy to set up a Netsuite authorization without needing a frontend client using CLI utilities.\r\n\r\n### Docs ###\r\n[Netsuite API Documentation](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_158022624537.html)\r\n\r\n## What do I need to get set up? ##\r\n* Run `pip install netsuite-python`\r\n* Activate your python VENV\r\n* If using virtual environment \r\n * Activate your virtual environment\r\n * `netsuite = python venv/bin/keap`\r\n\r\n# QUICK START #\r\n\r\n## Prerequisite Setup ##\r\n 1. Enable Services\r\n * Restlets\r\n * Rest Web Services\r\n * OAUTH 2.0\r\n 2. Create a role for the integration with the following permissions:\r\n * Access Token Management\r\n * Log in using Access Tokens\t\r\n * Log in using OAuth 2.0 Access Tokens\t\r\n * OAuth 2.0 Authorized Applications Management\t\r\n * REST Web Services\t\r\n * SuiteApp Deployment\t\r\n * SuiteScript\r\n * User Access Tokens\t\r\n 3. Create an integration record \r\n * Check Client Credentials ( MAchine to Machine Grant)\r\n * Under Scope Select \r\n * Restlets\r\n * Rest Web Services\r\n * STORE THE CLIENT ID \r\n 4. Create and upload the certificate\r\n * with dev environment setup, run ```netsuite generate-certificate```\r\n * upload the public cert to Netsuite under Setup -> Integrations -> Manage Oauth 2.0\r\n\r\n\r\n## Setup The Easy Way ##\r\nrun ``` netsuite initialize ```\r\n* Follow the prompts\r\n\r\n* Docs will be located in the generated \"netsuite_rest_client folder\" at the rot of the project\r\n\r\n#### Usage ####\r\n```python\r\n# import Netsuite Package\r\nfrom netsuite import Netsuite\r\n# import the generated Client\r\nfrom netsuite_rest_client import apis, rest_api_client\r\n# import models\r\nfrom netsuite_rest_client.model.customer import Customer\r\n# instantiate the SDK\r\nnetsuite = Netsuite()\r\n# Instantiate the generated Client\r\nrest_client = rest_api_client.RestApiClient(netsuite)\r\n# Instantiate the generated API endpoints using the generated client\r\ncustomer_api = apis.CustomerApi(rest_client)\r\n\r\n\r\n```\r\n\r\n#### Notes ####\r\n * Requirements\r\n * Sandbox requires the same setup as Prod, it DOES NOT copy over\r\n * An administrator for the Netsuite app to follow the steps [here](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_157771281570.html)\r\n * A user with the correct role\r\n * A role with the correct permissions\r\n * An Integration Record with the correct permissions (ensure default form is set correctly)\r\n * Client ID and Secret comes from this step, ensure they provide these\r\n * Certificate ID\r\n * A Certificate can be generated once you register the package with CLI with 'netsuite generate-certificate' \r\n * Cert ID is available under Setup -> Integration -> OAuth 2.0 Client Credentials once the certificate is uploaded.\r\n\r\n## Use Restlets ##\r\nsaved search example ref: https://timdietrich.me/blog/netsuite-saved-search-api/\r\n```python\r\n# import restlet client\r\nrestlet_client = netsuite.RESTLET_CLIENT.restlet_api\r\n# create body params \r\nbody_params = {\"searchID\": 'customsearch184275'}\r\n# call restlet\r\nprint(restlet_client.execute_restlet(script=1999, deploy=1, body_params=body))\r\n```\r\n\r\n## Regenerating the API Client with more records types\r\nre-run ```netsuite generate-rest-client```\r\n* when asked about using more record types, choose option that lets you set them\r\n* pick record types from the list\r\n* complete prompts\r\n\r\n## Uploading x509 certificate to Netsuite ##\r\n* On Client's Netsuite top ribbon go to `Setup -> Integration -> OAuth 2.0 Client Credentials`\r\n* Click `Create-New` button\r\n * Entity: The User created for TAG\r\n * ROLE: Role created for this integration\r\n * Application: Application Created for this integration\r\n * Certificate: Click \"Choose A File\" and upload the PUBLIC Cert (called netsuite-certificate.pem by default)\r\n* Copy the Certificate ID\r\n\r\n\r\n# Other Commands #\r\n\r\n## Generating x509 certificate for Netsuite ###\r\n * Run `netsuite generate-certificate`\r\n * Domain: theapiguys.com\r\n * Organization: TAG \r\n * Department: DEV\r\n * City: BOSTON\r\n * State: MA\r\n * Country: US\r\n * Email: will@theapiguys.com\r\n \r\n * It will store the cert in a file in the root of the project under config/netsuite\r\n\r\n\r\n## Setting up Netsuite SDK in a project ##\r\n* Run `netsuite generate-client-config`\r\n * It will ask you for information obtained above: You can use all the defaults\r\n * Client ID\r\n * Netsuite Certificate ID\r\n * Netsuite Key File\r\n * Netsuite Application Name \r\n * Storage Class\r\n \r\n * If you want to save to file\r\n * Provide a valid path for netsuite-credentials.json\r\n * else the credentials will be echoed out\r\n * To confirm, check the netsuite credentials path you entered, or the default, and there should be a json file with all\r\n the info you entered. Verify the details.\r\n\r\n## Getting The Access Token ##\r\n* Run `$netsuite get-access-token`\r\n * Use the defaults or repeat the info used above for\r\n * Path to Netsuite Credentials\r\n * Confirm the app name to be refreshed, if single app, just use default\r\n* That's it! You should now have a valid token to use with the Netsuite API.\r\n\r\n\r\n\r\n\r\n\r\n",
"bugtrack_url": null,
"license": "",
"summary": "Python SDK for Netsuite API with Flask Integration",
"version": "1.6.4",
"project_urls": {
"Homepage": "https://github.com/codinlikewilly/netsuite_python"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ccbd6acb806206c427b3322db7cf694bff64ec8cdc166595cffeb16662e4b15e",
"md5": "78080af8877a7eb116bf3471b1ed8d64",
"sha256": "43e9ecdd921fc54a47d0bddd66be06c7fab9ce04f07dc143462e0c66fe203c63"
},
"downloads": -1,
"filename": "netsuite_python-1.6.4.tar.gz",
"has_sig": false,
"md5_digest": "78080af8877a7eb116bf3471b1ed8d64",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 27991,
"upload_time": "2023-10-25T17:28:21",
"upload_time_iso_8601": "2023-10-25T17:28:21.569014Z",
"url": "https://files.pythonhosted.org/packages/cc/bd/6acb806206c427b3322db7cf694bff64ec8cdc166595cffeb16662e4b15e/netsuite_python-1.6.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-25 17:28:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "codinlikewilly",
"github_project": "netsuite_python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "netsuite-python"
}