The following prerequisites must be met before you can access our APIs:
It is important to complete testing within 90 days of your registration being accepted. If you are unable to complete testing within 90 days, your registration will expire and you will need to reregister.
IMPORTANT: With the exception of browser redirects during OAuth 2.0, all other requests between you and PG&E are over mutual SSL and require that you attach your client SSL certificate to your request. (This needs to be the same certificate you sent to PG&E prior to being accepted.)
The following user types are required to complete API Connectivity Testing:
Standard User, Self Access, Energy Efficiency Finance and Community Choice Aggregator
Purpose:
The purpose of the API Connectivity Test is to ensure you are able to connect to the Share My Data APIs.
RECOMMENDED: Retrieving Client Access Token using SOAP UI
Sample steps for performing the first step of connectivity testing (retrieving a Client Access Token) using SOAP UI Tool.
Download the SOAP UI Tool (PDF, 520 KB).
As implementations may vary, this is intended only as a reference to help illustrate how API connections to PG&E should be performed over mutual (2-way) SSL.
API Connectivity Test Steps:
To get started, download PG&E's Entrust SSL Certificate by logging in to your account. Then select "Manage Registration" to retrieve your <Client_ID> and <Client_Secret>. These credentials will be displayed in the Registration Milestone Table, when your registration is accepted.
Use the client credentials to get a client access token:
Use the client access token to call the service status API:
Use the client access token to request the sample data:
You will have completed API Connectivity Test once you have successfully received the sample data and you will see an "API Connectivity Test: Completed" milestone in the Registration milestone table as shown below.
The following users are required to complete OAuth Testing:
Standard User and Energy Efficiency Finance
Purpose:
The purpose of the OAuth Test is to ensure your OAuth implementation works correctly.
Please Note:
For the purposes of this test, your application will need to be pointed to the following endpoints in order to request the "test authorization code" and the "test access token":
OAuth Test Directions:
At this point, you will have successfully completed the OAuth Test and you will see an "OAuth Test: Completed" milestone in the Registration milestone table as shown below:
IMPORTANT: Upon completing testing, you must repoint your application to the Production Endpoints for Authorization Code and Access Token Request in order for customers to authorize you access to their data. These endpoints will be provided to you in the Application Information Resource (see below).
The following user types are required to make the Application Information Resource Request:
Standard User and Energy Efficiency Finance
Purpose:
The purpose of the Application Information Resource Request is to ensure you receive the production URLs for authorizationServerEndpoint and authorizationServerTokenEndpoint along with the dataCustodianScopeSelectionScreenURI
Application Information Resource Request Steps:
You will need your Registration Access Token and Application Information ID to request the Application information Resource.
Retrieve Registration Access Token
To retrieve your Registration Access Token log in to your Share My Data account and select "Manage Registration." Your <Registration Access Token> will be displayed in the Registration Milestone table when your registration is accepted.
Retrieve Application Information ID
Use the client access token retrieved during API Connectivity Test to call the Authorization xml:
Make a GET request against this URL:
https://api.pge.com/GreenButtonConnect/espi/1_1/resource/Authorization
Pass the client access token in the authorization header in the format, below:
Header param name = Authorization
Value = Bearer <client access token>
In the response you will see the Application Information ID:
Request the Application Information Resource
Call the Application Information endpoint with GET to the following url: https://api.pge.com/GreenButtonConnect/espi/1_1/resource/ApplicationInformation/{ApplicationInformationID}.
Substitute {ApplicationInformationID} with the application information ID you retrieved
Add basic Authorization header parameter. The header parameter will be in the format, below:
Param name : Authorization
Param value : Bearer <registration_access_token>
The response will give you the application information resource
IMPORTANT: For instructions on how to complete the signature, please review the Green Button Implementation Agreement.
The Application Information Resource will include the following information:
If you are a Standard User or Energy Efficiency Finance user, this is the last of the three testing requirements, and, after review, your Registration will be moved to Approved as shown below. With an Approved Registration customers can now authorize you to access their data via their My Energy account, or via redirect thru your website using the <datacustodianscopeselectionURI> provided to you in the Application Information Resource Request.
IMPORTANT: You must repoint your application to the Production Endpoints for Authorization Code and Access Token Request in order for customers to authorize you access to their data. These endpoints are provided to you in the Application Information Resource.
To learn more about how customers grant third parties access to their data visit Authorization Details
Once you have received customer authorization, you may begin utilizing our APIs to access the authorized data. For more information, visit Data Access
If you have questions or comments, please email our team at ShareMyData@pge.com.