## Introduction

The Wellbarrier API allows external applications to get well barrier diagrams and their associated activities from DrillPlan.

Today a user creates well barrier diagrams in Wellbarrier® (a separate application to DrillPlan) and fetches them into DrillPlan's Wellbarrier object editor. Here, the barrier diagrams are initially grouped under their respective `wellbore` and `section`, and users are able to further associate them with a collection of `L6_activities`.

### Get Barrier Illustrations

The first endpoint returns the list of well barrier illustrations by `planId` and their corresponding `L6_activity` assignments. The `planId` can be retrieved using the [Project Plan API](/solutions/drillplan/apis/projectplanapi). Please see corresponding tutorial for additional details.

details
summary
Example Get Request: well barrier illustrations and associated activities 
small
(click to open)
```curl
curl -L -X GET '{baseURL}/drillplan/wellbarrier/v1/activity-associations/by-plan/{plan_id}'
-H 'accept: application/json'
-H 'slb-partition-id: {SlbPartitionId}'
-H 'appkey: {appKey}'
-H 'Authorization: Bearer {token}'
```

details
summary
Example Response Body 
small
(click to open)
```json
{
 "planId": "0ed19f23f6754ecea60c129ed38d6fbb",
 "wellBarrierId": "e8fa8892a08c46949d1d86554545b1ba",
 "activityAssociations": [
  {
   "l3ActivityId": "",
   "l6ActivityId": "e7813a86-9d07-41fd-a099-6288fcc8623b",
   "illustrationName": "SC.V 1.2-a2 rev. 1 - Drilling run",
   "illustrationId": "72ce518f-3b41-4c07-8388-bf70748f247c"
  },
  {
   "l3ActivityId": "",
   "l6ActivityId": "1807ecab-0aec-464b-8249-4f85c0180933",
   "illustrationName": "SC.V 1.2-a2 rev. 1 - Drilling run",
   "illustrationId": "72ce518f-3b41-4c07-8388-bf70748f247c"
  }
 ]
}
```

br
> Note: See **Activity notes** below for further information about `L6_activities` and where to retrieve them.


### Get Illustration

The second endpoint is used to extract a specific barrier illustration. This will be a PDF file.

details
summary
Example Get Request: well barrier illustration 
small
(click to open)
```curl
curl -L -X GET '{baseURL}/drillplan/wellbarrier/v1/<<TBD>>'
-H 'accept: application/json'
-H 'slb-partition-id: {SlbPartitionId}'
-H 'appkey: {appKey}'
-H 'Authorization: Bearer {token}'
```

details
summary
Example Response Body 
small
(click to open)
```pdf
PDF
```

hr
#### Activity Notes

The [Project Plan API](/solutions/drillplan/apis/projectplanapi) can be used to get the list of `projects` and their corresponding `plans`. The `planId` is then used to get the list of plan `artifacts`.

More details can be found in the [Project Plan API Tutorial](/solutions/drillplan/docs/tutorials/api-consumption-guide/project-plan-api)

The comphrensive list of planned activities can be found inside the `ActivityPlan_public_vXX` plan artifact.

details
summary
Example snippet from a `ActivityPlan_public_vXX` artifact 
small
(click to open)
```xml
<?xml version="1.0" encoding="utf-8"?>
<ActivityPlan
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns="http://www.slb.com/schema/activityplan">
 <name>Activity Plan</name>
 <activities>
  <activity xsi:type="L3" uid="79eeb1e7-8659-4887-812b-c8a0a7d9a9f4">
   <name>Construct section | 17.5 in</name>
   ...
   <level>L3</level>
  </activity>
  ...
  <activity xsi:type="L6" uid="e7813a86-9d07-41fd-a099-6288fcc8623b">
   <name>Trip in to depth | 0–65.62 ft</name>
   ...
   <level>L6</level>
  </activity>
  <activity xsi:type="L6" uid="7c7a985a-ec0d-425b-bffd-2ffe0d799223">
      <name>Drill shoe track | 1328–1348 m</name>
	  ...
      <level>L6</level>
    </activity>
  </activities>
</ActivityPlan>
```

**Where:**
`uid` corresponds to the `l3ActivityId` and `l6ActivityId` returned in the `GET Well barrier illustrations and associated activities` endpoint