GraphQL Tutorial
Apollo Studio GraphQL Setup
The URL for the Xecta GQL endpoint is: https://api.onxecta.com/api/gql
Navigate to Apollo Studio
To navigate to Apollo Studio, open your web browser and navigate to https://api.onxecta.com/api/gql

Generate Bearer Token and Configure Headers
JWT Token
You can use a user-based JWT from the ProdX application or a bearer token from MTLS. For MTLS, please refer to the Postman Tutorial for instructions on obtaining a token. To obtain a user-based, navigate to ProdX at [customer].app.onxecta.com, click on your initials in the top right corner of the screen to open the menu, and click directly on your name to copy a token to the clipboard.
Note: JWT tokens expire after a period of time. If queries stop functioning, generate a new token and update your query or shared header.

Headers
Add a Header with the key name "Authorization" and the value as "Bearer {INSERT JWT TOKEN HERE}". Make sure you leave a space between bearer and the token itself.
Adding a header as shown below will only apply to the current query. If you click the link at the bottom right of the center column titled "Set Shared Headers", you can set a global header which will apply to all query tabs you have open.
Note: JWT tokens expire after a period of time. If queries stop functioning, generate a new token and update your query or shared header.

Query Wells
For many of the GraphQL requests, you will need to run a query to get the XID's (Xecta's unique identifiers for your data entries) for the wells which you want to interact with. You can enter a query manually in the center "operation" section of apollo or you can use the navigation tree on the right side of the screen to interactively build a query. Hovering over items in the tree will launch a popup with additional documentation about the entity.
query GetWellInfo {
wells2 {
xid
uwi
sourceId
name
}
}Paste this query into Apollo Studio and click the "GetWellInfo" execution button

This will return all wells in the database in the response section on the right.
Query Well Performance Analysis Results
One of the most common queries is for cleansed daily data supplemented with all daily output values from ProdX (like bottomhole pressure, productivity index, etc.). The sample below shows you how to query for this information.
query WellPerformanceAnalysisResults($where: WellPerformanceAnalysisResultFilterInput, $wellsCriteria: WellsCriteria) {
wells2(wellsCriteria: $wellsCriteria) {
xid
name
wellPerformanceAnalysisResults(where: $where) {
wellXid
bottomholeDepth
bottomholeDepthSource
bottomholePressure
bottomholeDepthReservoir
bottomholeDepthSourceReservoir
bottomholePressureReservoir
bottomholePressureCorrelation
reservoirPressure
productivityIndexOil
productivityIndexGas
productivityIndexLiquid
productivityIndexWater
cumulativeOilProduction
cumulativeWaterProduction
cumulativeGasProduction
cumulativeGasOilRatio
timeOn
gasOilRatio
waterCut
instantaneousRecoveryRatioTotal
dynamicDrainageVolumeTotal
productionMethod
elapsedTime
productionDelta
current
drawdown
epochTime
opportunity
opportunityField
recommendation
recommendationField
liquidRate
boeRate
cumulativeBoeProduction
cumulativeLiquidProduction
timeOnOil
timeOnGas
timeOnLiquid
downtimeCorrectedOilRate
downtimeCorrectedWaterRate
downtimeCorrectedGasRate
downtimeCorrectedGasLiftInjectionRate
downtimeCorrectedWaterInjectionRate
downtimeCorrectedGasInjectionRate
espHeadDegradationPercent
rateNormalizedDeltaPressureChoke
pressureNormalizedRateLiquid
pressureNormalizedRateOil
pressureNormalizedRateGas
gasLiquidRatio
inSituRateGaugeNode
criticalGasRateSurface
criticalGasRateGaugeNode
criticalGasRateTurnerGaugeNode
criticalGasRateColemanGaugeNode
criticalGasRateNagooGaugeNode
totalGasRate
espHead
espGasSeparationEfficiency
xid
date
oilRate
gasRate
waterRate
tubingPressure
choke
gaugePressure
wellheadTemperature
gaugeTemperature
casingPressure
linePressure
gasLiftInjectionRate
espFrequency
espIntakePressure
espAmps
espVolts
espDischargePressure
espMotorTemperature
espVibration
srpStrokesPerMin
srpIntakePressure
srpFluidLoad
srpFillage
downtimeHours
downtimeCode
waterInjectionRate
gasInjectionRate
isAnnularFlow
}
}
}Paste the query above into the "Operation" panel of Apollo Studio.

For this query, you will have to add "Variables" for the start date, end date, and a list of XIDs (Xecta unique identifier for the well) that you want to query.
At the bottom of the Apollo Studio, click the "Variables" tab, and paste in the following code. Make sure the startDate and endDate are ISO8601 complaint date strings.
{
"where": {
"date": {
"gte": "2000-01-01T06:00:00.000Z",
"lte": "2024-01-01T06:00:00.000Z"
}
},
"wellsCriteria": {
"xids": ["96cbd395-a590-4573-b819-793e6a1bddc7"]
}
}Press the blue "WellPerformanceAnalysisResults" Execution button in the top right of the "Operation" section of apollo studio. You will see your results for your listed wells on the right

You can change from a JSON to Tabular view by switching between the icons below
