Package: netsuite-python
READMEThis library makes it easy to set up a Netsuite authorization without needing a frontend client using CLI utilities.DocsNetsuite API DocumentationWhat do I need to get set up?Runpip install netsuite-pythonActivate your python VENVIf using virtual environmentActivate your virtual environmentnetsuite = python venv/bin/keapQUICK STARTPrerequisite  Setup1. 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.0Setup The Easy Wayrunnetsuite initializeFollow the promptsDocs will be located in the generated "netsuite_rest_client folder" at the rot of the projectUsage# import Netsuite PackagefromnetsuiteimportNetsuite# import the generated Clientfromnetsuite_rest_clientimportapis,rest_api_client# import modelsfromnetsuite_rest_client.model.customerimportCustomer# instantiate the SDKnetsuite=Netsuite()# Instantiate the generated Clientrest_client=rest_api_client.RestApiClient(netsuite)# Instantiate the generated API endpoints using the generated clientcustomer_api=apis.CustomerApi(rest_client)NotesRequirementsSandbox requires the same setup as Prod, it DOES NOT copy overAn administrator for the Netsuite app to follow the stepshereA user with the correct roleA role with the correct permissionsAn Integration Record with the correct permissions (ensure default form is set correctly)Client ID and Secret comes from this step, ensure they provide theseCertificate IDA 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 Restletssaved search example ref:https://timdietrich.me/blog/netsuite-saved-search-api/# import restlet clientrestlet_client=netsuite.RESTLET_CLIENT.restlet_api# create body paramsbody_params={"searchID":'customsearch184275'}# call restletprint(restlet_client.execute_restlet(script=1999,deploy=1,body_params=body))Regenerating the API Client with more records typesre-runnetsuite generate-rest-clientwhen asked about using more record types, choose option that lets you set thempick record types from the listcomplete promptsUploading x509 certificate to NetsuiteOn Client's Netsuite top ribbon go toSetup -> Integration -> OAuth 2.0 Client CredentialsClickCreate-NewbuttonEntity: The User created for TAGROLE: Role created for this integrationApplication: Application Created for this integrationCertificate: Click "Choose A File" and upload the PUBLIC Cert (called netsuite-certificate.pem by default)Copy the Certificate IDOther CommandsGenerating x509 certificate for NetsuiteRunnetsuite generate-certificateDomain: theapiguys.comOrganization: TAGDepartment: DEVCity: BOSTONState: MACountry: USEmail:will@theapiguys.comIt will store the cert in a file in the root of the project under config/netsuiteSetting up Netsuite SDK in a projectRunnetsuite generate-client-configIt will ask you for information obtained above: You can use all the defaultsClient IDNetsuite Certificate IDNetsuite Key FileNetsuite Application NameStorage ClassIf you want to save to fileProvide a valid path for netsuite-credentials.jsonelse the credentials will be echoed outTo 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 TokenRun$netsuite get-access-tokenUse the defaults or repeat the info used above forPath to Netsuite CredentialsConfirm the app name to be refreshed, if single app, just use defaultThat's it! You should now have a valid token to use with the Netsuite API.