# Get External Source

- Operation ID: `getExternalSourceById`
- HTTP method: `GET`
- Path: `/brickworks/v1/external-sources/{ExternalDataSourceId}`
- [Human-readable API reference](https://hub.synerise.com/api-reference/brickworks#tag/Brickworks:-External-sources/operation/getExternalSourceById)

## Self-contained OpenAPI method

The fenced document below contains this method's documentation and all of its local references. It is self-contained; no category or master specification fetch is required.

```yaml
openapi: 3.0.0
info:
  title: Synerise Public API
  version: 1.9.1
paths:
  /brickworks/v1/external-sources/{ExternalDataSourceId}:
    get:
      tags:
        - "Brickworks: External sources"
      summary: Get External Source
      description: |
        Retrieve the details of an external data source.

        ---

        **API consumers:** <a href="/api-reference/authorization?tag=Authorization&amp;operationId=userLogin" target="_blank" rel="noopener">Synerise User</a>, <a href="/api-reference/authorization?tag=Authorization&amp;operationId=profileLogin" target="_blank" rel="noopener">Workspace (Business Profile)</a>

        **API key permission required:** `BRICKWORKS_EXTERNALSOURCES_READ`

        **User role permission required:** `assets_brickworks: read`
      operationId: getExternalSourceById
      security:
        - JWT: []
      parameters:
        - name: ExternalDataSourceId
          in: path
          required: true
          description: External source ID
          schema:
            type: string
            format: uuid
      responses:
        "200":
          description: Details of the external source
          content:
            application/json:
              schema:
                type: object
                x-class-name: ExternalSourceModel
                x-interface-name-ts: ExternalSourceModel
                properties:
                  id:
                    type: string
                    description: Unique ID of the external source definition
                    format: uuid
                  name:
                    type: string
                    description: Human-readable name of the external resource
                    maxLength: 255
                  description:
                    type: string
                    maxLength: 255
                    description: Description of the external source
                  properties:
                    type: object
                    x-class-name: ExternalSourceProperties
                    x-interface-name-ts: ExternalSourceProperties
                    description: The details of the external source configuration
                    properties:
                      sourceType:
                        type: string
                        x-class-name: ExternalSourceType
                        x-interface-name-ts: ExternalSourceType
                        enum:
                          - http_source
                      url:
                        type: string
                        description: URL address of the resource, including the `https` protocol. May include Jinjava inserts.
                        example: https://example.com/clients/{% customer email %}
                      method:
                        type: string
                        description: The HTTP method used in the external request. The `body` and `bodySchema` properties can only be used in POST requests.
                        enum:
                          - post
                          - get
                      headers:
                        type: object
                        x-class-name: ExternalSourceHeaders
                        x-interface-name-ts: ExternalSourceHeaders
                        description: Headers added to the request
                        additionalProperties:
                          type: string
                          description: Each key is the name of the header, and the value is the header's value.
                      params:
                        type: object
                        x-class-name: ExternalSourceParams
                        x-interface-name-ts: ExternalSourceParams
                        description: Query parameters added to the URL
                        additionalProperties:
                          type: string
                          description: A key/value pair
                      authType:
                        type: string
                        x-class-name: ExternalSourceAuthType
                        x-interface-name-ts: ExternalSourceAuthType
                        enum:
                          - basic
                          - api_key
                          - custom
                        description: The mode of authentication used by this external source
                      authId:
                        type: string
                        format: uuid
                        description: Unique identifier of a [connection](https://hub.synerise.com/docs/settings/tool/connections/) used by this external source.
                      body:
                        type: object
                        x-class-name: ExternalSourceBody
                        x-interface-name-ts: ExternalSourceBody
                        description: The request body sent to the external source
                        additionalProperties:
                          description: JSON content. If you want to use JinJava in a value, use `bodySchema` to define which fields accept Jinjava.
                        example:
                          someString: string
                          someObject:
                            key: "{% customer email %}"
                          dynamicField: "{% customer id %}"
                      bodySchema:
                        type: object
                        title: External source body schema
                        x-class-name: ExternalSourceBodySchema
                        x-interface-name-ts: ExternalSourceBodySchema
                        description: A schema which defines which fields in the request body have dynamic values inserted with Jinjava. Static parameters don't need to be listed in this schema.
                        properties:
                          properties:
                            description: |
                              The properties in the request body. You only need to define dynamic values (jinjava strings), and if they are nested in an object, use the `object` schema to define that structure.
                            type: object
                            additionalProperties:
                              type: object
                              x-class-name: BodySchemaEntity
                              x-interface-name-ts: BodySchemaEntity
                              description: The object name corresponds to a key name in the request body.
                              additionalProperties:
                                oneOf:
                                  - $ref: "#/components/schemas/brickworks-service-ExternalSourceBodySchema"
                                  - type: object
                                    title: String
                                    x-class-name: BodySchemaString
                                    x-interface-name-ts: BodySchemaString
                                    properties:
                                      type:
                                        type: string
                                        title: String type
                                        x-class-name: StringType
                                        x-interface-name-ts: StringType
                                        enum:
                                          - string
                                      subtype:
                                        type: string
                                        x-class-name: JinJavaSubtype
                                        x-interface-name-ts: JinJavaSubtype
                                        enum:
                                          - jinjava
                                      settings:
                                        type: object
                                        x-class-name: JinJavaSettings
                                        x-interface-name-ts: JinJavaSettings
                                        nullable: true
                                        description: Settings for casting the Jinjava result to a data type. Casting may not be successful - set the `strict` setting to decide how to proceed in that case.
                                        properties:
                                          castType:
                                            type: string
                                            description: The data type to try casting the Jinjava result to
                                            x-class-name: JinJavaCastType
                                            x-interface-name-ts: JinJavaCastType
                                            enum:
                                              - boolean
                                              - integer
                                              - number
                                              - json
                                          strict:
                                            type: boolean
                                            description: |
                                              Defines what happens when casting is not successful:
                                              - `true` throws an error in generating an object from a record
                                              - `false` sets the value to null
                                          removeWhitespaces:
                                            type: boolean
                                            description: |
                                              When `true`, all whitespace characters (e.g. `\r`, `\n`, spaces, tabs) are removed from the Jinjava render result before casting.
                                        required:
                                          - strict
                                          - castType
                                discriminator:
                                  propertyName: subtype
                                  mapping:
                                    jinjava: "#/components/schemas/brickworks-service-BodySchemaString"
                                    key_value: "#/components/schemas/brickworks-service-ExternalSourceBodySchema"
                              x-typescript-type: "{ [key: string]: BodySchemaEntity }"
                          type:
                            type: string
                            description: Objects can include or other objects (recursive schema)
                            enum:
                              - object
                          subtype:
                            type: string
                            x-class-name: KeyValueSubtype
                            x-interface-name-ts: KeyValueSubtype
                            description: |
                              This type of field is a reference to an external source. The request to an external source is made when you generate content from a record.

                              **NOTE**: The `headers`, `params`, and `body` properties are not currently supported by the Synerise Portal.
                            enum:
                              - key_value
                          additionalProperties:
                            type: boolean
                            description: Defines if the object can include other properties than the one listed in the schema
                            enum:
                              - true
                        example:
                          type: object
                          subtype: key_value
                          properties:
                            someObject:
                              type: object
                              subtype: key_value
                              properties:
                                key:
                                  type: string
                                  subtype: jinjava
                              additionalProperties: true
                            dynamicField:
                              type: string
                              subtype: jinjava
                          additionalProperties: true
                    required:
                      - sourceType
                      - url
                      - method
                  createdBy:
                    type: integer
                    format: int64
                    description: ID of the user who created the resource. If created by a workspace, the value is `0`.
                  createdAt:
                    type: string
                    format: date-time
                    description: Time when the resource was created
                  updatedBy:
                    type: integer
                    format: int64
                    description: ID of the user who last updated the resource. If last updated by a workspace, the value is `0`.
                  updatedAt:
                    type: string
                    format: date-time
                    description: Time when the resource was last updated
                  ttl:
                    type: number
                    format: int32
                    description: Cache TTL for connection response, in seconds
                required:
                  - id
                  - name
                  - properties
                  - createdBy
                  - createdAt
                  - updatedAt
        "400":
          description: Incorrect request (malformed JSON, wrong parameters, etc.). See error message for details.
          content:
            application/json:
              schema:
                type: object
                x-class-name: ObjectsError
                x-interface-name-ts: ObjectsError
                required:
                  - httpStatus
                  - errorCode
                  - timestamp
                  - message
                properties:
                  timestamp:
                    type: string
                    format: date-time
                    description: Time when the error occurred
                  errorCode:
                    type: string
                    description: |
                      Code of the error, needed for troubleshooting

                      See error reference: [https://developers.synerise.com/errors.html](https://developers.synerise.com/errors.html)
                  httpStatus:
                    type: integer
                    description: Error's HTTP status code
                  message:
                    type: string
                    description: Description of the problem
                  traceId:
                    type: string
                    description: Unique identifier of the request, useful for tracing logs
                  errors:
                    type: array
                    items:
                      $ref: "#/components/schemas/brickworks-service-ObjectsError"
                  source:
                    type: object
                    x-class-name: ObjectErrorSource
                    x-interface-name-ts: ObjectErrorSource
                    required:
                      - pointer
                    properties:
                      pointer:
                        type: string
                        description: JSON Pointer for invalid body path
                      value:
                        type: string
                        description: Value that caused the validation error
                  details:
                    type: object
                    x-class-name: ObjectsErrorDetails
                    x-interface-name-ts: ObjectsErrorDetails
                    additionalProperties:
                      type: object
                    description: Additional structured error information
                  field:
                    type: string
                    description: Name of the field that caused the error
        "401":
          description: "Unauthorized: wrong consumer scope; token missing/expired/invalid; invalid API key; etc. See error message for details."
          content:
            application/json:
              schema:
                type: object
                x-class-name: GatewayError
                x-interface-name-ts: GatewayError
                properties:
                  error:
                    type: string
                    description: Summary of the error
                  status:
                    type: integer
                    format: int32
                    description: Status code
                  timestamp:
                    type: string
                    description: Time when the message was sent
                  message:
                    type: string
                    description: Description of the problem
        "403":
          description: Forbidden; insufficient permissions. See error message for details.
          content:
            application/json:
              schema:
                type: object
                x-class-name: GatewayError
                x-interface-name-ts: GatewayError
                properties:
                  error:
                    type: string
                    description: Summary of the error
                  status:
                    type: integer
                    format: int32
                    description: Status code
                  timestamp:
                    type: string
                    description: Time when the message was sent
                  message:
                    type: string
                    description: Description of the problem
        "404":
          description: Resource not found. See error message for details.
          content:
            application/json:
              schema:
                type: object
                x-class-name: ObjectsError
                x-interface-name-ts: ObjectsError
                required:
                  - httpStatus
                  - errorCode
                  - timestamp
                  - message
                properties:
                  timestamp:
                    type: string
                    format: date-time
                    description: Time when the error occurred
                  errorCode:
                    type: string
                    description: |
                      Code of the error, needed for troubleshooting

                      See error reference: [https://developers.synerise.com/errors.html](https://developers.synerise.com/errors.html)
                  httpStatus:
                    type: integer
                    description: Error's HTTP status code
                  message:
                    type: string
                    description: Description of the problem
                  traceId:
                    type: string
                    description: Unique identifier of the request, useful for tracing logs
                  errors:
                    type: array
                    items:
                      $ref: "#/components/schemas/brickworks-service-ObjectsError"
                  source:
                    type: object
                    x-class-name: ObjectErrorSource
                    x-interface-name-ts: ObjectErrorSource
                    required:
                      - pointer
                    properties:
                      pointer:
                        type: string
                        description: JSON Pointer for invalid body path
                      value:
                        type: string
                        description: Value that caused the validation error
                  details:
                    type: object
                    x-class-name: ObjectsErrorDetails
                    x-interface-name-ts: ObjectsErrorDetails
                    additionalProperties:
                      type: object
                    description: Additional structured error information
                  field:
                    type: string
                    description: Name of the field that caused the error
        "409":
          description: The request could not be completed due to a conflict with the current state of the resource. See error message for details.
          content:
            application/json:
              schema:
                type: object
                x-class-name: ObjectsError
                x-interface-name-ts: ObjectsError
                required:
                  - httpStatus
                  - errorCode
                  - timestamp
                  - message
                properties:
                  timestamp:
                    type: string
                    format: date-time
                    description: Time when the error occurred
                  errorCode:
                    type: string
                    description: |
                      Code of the error, needed for troubleshooting

                      See error reference: [https://developers.synerise.com/errors.html](https://developers.synerise.com/errors.html)
                  httpStatus:
                    type: integer
                    description: Error's HTTP status code
                  message:
                    type: string
                    description: Description of the problem
                  traceId:
                    type: string
                    description: Unique identifier of the request, useful for tracing logs
                  errors:
                    type: array
                    items:
                      $ref: "#/components/schemas/brickworks-service-ObjectsError"
                  source:
                    type: object
                    x-class-name: ObjectErrorSource
                    x-interface-name-ts: ObjectErrorSource
                    required:
                      - pointer
                    properties:
                      pointer:
                        type: string
                        description: JSON Pointer for invalid body path
                      value:
                        type: string
                        description: Value that caused the validation error
                  details:
                    type: object
                    x-class-name: ObjectsErrorDetails
                    x-interface-name-ts: ObjectsErrorDetails
                    additionalProperties:
                      type: object
                    description: Additional structured error information
                  field:
                    type: string
                    description: Name of the field that caused the error
        "422":
          description: The request was well-formed but could not be processed due to semantic or domain-related constraints. See error message for details.
          content:
            application/json:
              schema:
                type: object
                x-class-name: ObjectsError
                x-interface-name-ts: ObjectsError
                required:
                  - httpStatus
                  - errorCode
                  - timestamp
                  - message
                properties:
                  timestamp:
                    type: string
                    format: date-time
                    description: Time when the error occurred
                  errorCode:
                    type: string
                    description: |
                      Code of the error, needed for troubleshooting

                      See error reference: [https://developers.synerise.com/errors.html](https://developers.synerise.com/errors.html)
                  httpStatus:
                    type: integer
                    description: Error's HTTP status code
                  message:
                    type: string
                    description: Description of the problem
                  traceId:
                    type: string
                    description: Unique identifier of the request, useful for tracing logs
                  errors:
                    type: array
                    items:
                      $ref: "#/components/schemas/brickworks-service-ObjectsError"
                  source:
                    type: object
                    x-class-name: ObjectErrorSource
                    x-interface-name-ts: ObjectErrorSource
                    required:
                      - pointer
                    properties:
                      pointer:
                        type: string
                        description: JSON Pointer for invalid body path
                      value:
                        type: string
                        description: Value that caused the validation error
                  details:
                    type: object
                    x-class-name: ObjectsErrorDetails
                    x-interface-name-ts: ObjectsErrorDetails
                    additionalProperties:
                      type: object
                    description: Additional structured error information
                  field:
                    type: string
                    description: Name of the field that caused the error
        "500":
          description: See error message for details.
          content:
            application/json:
              schema:
                type: object
                x-class-name: ObjectsError
                x-interface-name-ts: ObjectsError
                required:
                  - httpStatus
                  - errorCode
                  - timestamp
                  - message
                properties:
                  timestamp:
                    type: string
                    format: date-time
                    description: Time when the error occurred
                  errorCode:
                    type: string
                    description: |
                      Code of the error, needed for troubleshooting

                      See error reference: [https://developers.synerise.com/errors.html](https://developers.synerise.com/errors.html)
                  httpStatus:
                    type: integer
                    description: Error's HTTP status code
                  message:
                    type: string
                    description: Description of the problem
                  traceId:
                    type: string
                    description: Unique identifier of the request, useful for tracing logs
                  errors:
                    type: array
                    items:
                      $ref: "#/components/schemas/brickworks-service-ObjectsError"
                  source:
                    type: object
                    x-class-name: ObjectErrorSource
                    x-interface-name-ts: ObjectErrorSource
                    required:
                      - pointer
                    properties:
                      pointer:
                        type: string
                        description: JSON Pointer for invalid body path
                      value:
                        type: string
                        description: Value that caused the validation error
                  details:
                    type: object
                    x-class-name: ObjectsErrorDetails
                    x-interface-name-ts: ObjectsErrorDetails
                    additionalProperties:
                      type: object
                    description: Additional structured error information
                  field:
                    type: string
                    description: Name of the field that caused the error
      x-snr-doc-urls:
        - /api-reference/brickworks#tag/Brickworks:-External-sources/operation/getExternalSourceById
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request GET \
              --url https://api.synerise.com/brickworks/v1/external-sources/%7BExternalDataSourceId%7D \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'
        - lang: Python
          label: Python
          source: |-
            import http.client

            conn = http.client.HTTPSConnection("api.synerise.com")

            headers = { 'Authorization': "Bearer REPLACE_BEARER_TOKEN" }

            conn.request("GET", "/brickworks/v1/external-sources/%7BExternalDataSourceId%7D", headers=headers)

            res = conn.getresponse()
            data = res.read()

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = null;

            const xhr = new XMLHttpRequest();
            xhr.withCredentials = true;

            xhr.addEventListener("readystatechange", function () {
              if (this.readyState === this.DONE) {
                console.log(this.responseText);
              }
            });

            xhr.open("GET", "https://api.synerise.com/brickworks/v1/external-sources/%7BExternalDataSourceId%7D");
            xhr.setRequestHeader("Authorization", "Bearer REPLACE_BEARER_TOKEN");

            xhr.send(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const http = require("https");

            const options = {
              "method": "GET",
              "hostname": "api.synerise.com",
              "port": null,
              "path": "/brickworks/v1/external-sources/%7BExternalDataSourceId%7D",
              "headers": {
                "Authorization": "Bearer REPLACE_BEARER_TOKEN"
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on("data", function (chunk) {
                chunks.push(chunk);
              });

              res.on("end", function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $request = new HttpRequest();
            $request->setUrl('https://api.synerise.com/brickworks/v1/external-sources/%7BExternalDataSourceId%7D');
            $request->setMethod(HTTP_METH_GET);

            $request->setHeaders([
              'Authorization' => 'Bearer REPLACE_BEARER_TOKEN'
            ]);

            try {
              $response = $request->send();

              echo $response->getBody();
            } catch (HttpException $ex) {
              echo $ex;
            }
        - lang: Java
          label: Java
          source: |-
            HttpResponse<String> response = Unirest.get("https://api.synerise.com/brickworks/v1/external-sources/%7BExternalDataSourceId%7D")
              .header("Authorization", "Bearer REPLACE_BEARER_TOKEN")
              .asString();
servers:
  - description: Microsoft Azure EU
    url: https://api.synerise.com
  - description: Microsoft Azure USA
    url: https://api.azu.synerise.com
  - description: Google Cloud Platform
    url: https://api.geb.synerise.com
tags:
  - name: "Brickworks: External sources"
components:
  schemas:
    brickworks-service-ExternalSourceBodySchema:
      type: object
      title: External source body schema
      x-class-name: ExternalSourceBodySchema
      x-interface-name-ts: ExternalSourceBodySchema
      description: A schema which defines which fields in the request body have dynamic values inserted with Jinjava. Static parameters don't need to be listed in this schema.
      properties:
        properties:
          description: |
            The properties in the request body. You only need to define dynamic values (jinjava strings), and if they are nested in an object, use the `object` schema to define that structure.
          type: object
          additionalProperties:
            type: object
            x-class-name: BodySchemaEntity
            x-interface-name-ts: BodySchemaEntity
            description: The object name corresponds to a key name in the request body.
            additionalProperties:
              oneOf:
                - $ref: "#/components/schemas/brickworks-service-ExternalSourceBodySchema"
                - type: object
                  title: String
                  x-class-name: BodySchemaString
                  x-interface-name-ts: BodySchemaString
                  properties:
                    type:
                      type: string
                      title: String type
                      x-class-name: StringType
                      x-interface-name-ts: StringType
                      enum:
                        - string
                    subtype:
                      type: string
                      x-class-name: JinJavaSubtype
                      x-interface-name-ts: JinJavaSubtype
                      enum:
                        - jinjava
                    settings:
                      type: object
                      x-class-name: JinJavaSettings
                      x-interface-name-ts: JinJavaSettings
                      nullable: true
                      description: Settings for casting the Jinjava result to a data type. Casting may not be successful - set the `strict` setting to decide how to proceed in that case.
                      properties:
                        castType:
                          type: string
                          description: The data type to try casting the Jinjava result to
                          x-class-name: JinJavaCastType
                          x-interface-name-ts: JinJavaCastType
                          enum:
                            - boolean
                            - integer
                            - number
                            - json
                        strict:
                          type: boolean
                          description: |
                            Defines what happens when casting is not successful:
                            - `true` throws an error in generating an object from a record
                            - `false` sets the value to null
                        removeWhitespaces:
                          type: boolean
                          description: |
                            When `true`, all whitespace characters (e.g. `\r`, `\n`, spaces, tabs) are removed from the Jinjava render result before casting.
                      required:
                        - strict
                        - castType
              discriminator:
                propertyName: subtype
                mapping:
                  jinjava: "#/components/schemas/brickworks-service-BodySchemaString"
                  key_value: "#/components/schemas/brickworks-service-ExternalSourceBodySchema"
            x-typescript-type: "{ [key: string]: BodySchemaEntity }"
        type:
          type: string
          description: Objects can include or other objects (recursive schema)
          enum:
            - object
        subtype:
          type: string
          x-class-name: KeyValueSubtype
          x-interface-name-ts: KeyValueSubtype
          description: |
            This type of field is a reference to an external source. The request to an external source is made when you generate content from a record.

            **NOTE**: The `headers`, `params`, and `body` properties are not currently supported by the Synerise Portal.
          enum:
            - key_value
        additionalProperties:
          type: boolean
          description: Defines if the object can include other properties than the one listed in the schema
          enum:
            - true
      example:
        type: object
        subtype: key_value
        properties:
          someObject:
            type: object
            subtype: key_value
            properties:
              key:
                type: string
                subtype: jinjava
            additionalProperties: true
          dynamicField:
            type: string
            subtype: jinjava
        additionalProperties: true
    brickworks-service-ObjectsError:
      type: object
      x-class-name: ObjectsError
      x-interface-name-ts: ObjectsError
      required:
        - httpStatus
        - errorCode
        - timestamp
        - message
      properties:
        timestamp:
          type: string
          format: date-time
          description: Time when the error occurred
        errorCode:
          type: string
          description: |
            Code of the error, needed for troubleshooting

            See error reference: [https://developers.synerise.com/errors.html](https://developers.synerise.com/errors.html)
        httpStatus:
          type: integer
          description: Error's HTTP status code
        message:
          type: string
          description: Description of the problem
        traceId:
          type: string
          description: Unique identifier of the request, useful for tracing logs
        errors:
          type: array
          items:
            $ref: "#/components/schemas/brickworks-service-ObjectsError"
        source:
          type: object
          x-class-name: ObjectErrorSource
          x-interface-name-ts: ObjectErrorSource
          required:
            - pointer
          properties:
            pointer:
              type: string
              description: JSON Pointer for invalid body path
            value:
              type: string
              description: Value that caused the validation error
        details:
          type: object
          x-class-name: ObjectsErrorDetails
          x-interface-name-ts: ObjectsErrorDetails
          additionalProperties:
            type: object
          description: Additional structured error information
        field:
          type: string
          description: Name of the field that caused the error
  securitySchemes:
    JWT:
      type: http
      scheme: bearer
      description: |-
        JWT Bearer token. The header looks like this: `Bearer {JWT}`

        Remember to include the space between 'Bearer' and the token.

        Generate a token via the **Authorization** endpoints.
```
