C# Tutorial
Author(s): Dhilip Marimuthu and Ian Brown, September 2022
Developer Prerequisites:
- Visual Studio 2022 Community Edition
- Internet connection
Get the complete source code
Data Schema:
Please read the Data Schema Fundamentals document before using the API. Database CRUD operations are performed via the API and therefore it is important to think of each HTTP REST operation (POST/GET/DELETE) as a SQL transaction (UPSERT/SELECT/DELETE).
WellView® and OpenWells® Source Systems:
The API uses original source system IDs as key fields. For WellView and OpenWells data schema documentation provides guidance as to which table/view and which column/value to use as the source system ID. Guidance is provided for the Well Header, Wellbore and all other Wellbore related data sets
WellView is a registered trademark of Peloton Computer Enterprises Ltd. OpenWells is a registered trademark of Halliburton Landmark.
Visualizing Data: Data inserted or modified using this tutorial can be visualized using the web portal application(s) at https://<tenant>.app.onxecta.com. The portal contains a Model Quality tool where you can see what data is in the system, the validity of the data and when the data was last modified.
Open Visual Studio 2022 Community Edition and Create a new C# Console Application
Provide a name for the project e.g., ConsoleApp1
Choose .NET framework version NET 6.0 or higher
On the project Dependencies tree -> Right Click -> Manage NuGet Packages... Follow the stemps below to find and install the Xecta.Platform.Data.Client from NuGet package manager
On the NuGet Window -> Browse -> Search for Xecta.Platform.DataClient -> Select latest 2.X version.
To connect to the API, you will need:
- Your PEM File
- Your KEY File
- Client ID
- Client Secret
Open the program.cs - Delete the default Visual Studio "Hello World" code and replace it with the code snippet below
The code snippets in section 2 build on the code snippets used in section 2. The snippets assume you have successfully built and ran the code in Section 2. To read more about Well Headers and to see all of the properties.
Put this code directly below the below the Section 2 code snippet
The snippet below will delete all wells from the database Do not use this snippet unless you have a real-world use case
The code snippets below use source Ids from the wells created by the code snippets in Section 3. The snippets assume you have successfully built and ran the code in Section 3. To read more about a Wellbore and to see all of the properties.
A well must exist in the well header table before a wellbore can be added for that well. A well must have at least one wellbore
A wellbore must exist before the formation data for that wellbore can be created
Wellbore formation represents the rock properties and the fluid properties within the reservoir (formation) where the wellbore is producing the fluids from.
A wellbore must exist before survey data points can be created for that wellbore. To read more about a Deviation Survey and to see all of the properties.
A wellbore must exist before the casing information can be created for that wellbore. To read more about a casing and to see all of the properties.
A wellbore must exist before the tubing information can be created for that wellbore. To read more about tubing and to see all of the properties.
To read more about daily production records and to see all of the properties.
The daily production is related to the well. Not the wellbore. The well UWI property from the well header is used as the primary key for daily production records
See Section 3 for well header API details
Get Latest Production:
To get the most recent production record you have to get the history and then use the latest record. At the time of writing there is not an end point for Get Latest record.
The snippet below can run standalone without the other snippets above. The code reads a standard excel template and pushes the data from the excel template to the server. An example MS Excel template file called Excel-Import-Template.xlsx can be found in the Code Samples section.