### Get Token Info using Python Source: https://developers.dovetail.com/reference/authentication Python code to fetch token information from the Dovetail API. This example uses the 'requests' library to perform a GET request. Ensure 'requests' is installed (`pip install requests`). The response is printed as a JSON object. ```python import requests url = "https://dovetail.com/api/v1/token/info" headers = { "accept": "application/json" } try: response = requests.get(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes print(response.json()) except requests.exceptions.RequestException as e: print(f"Error: {e}") if hasattr(e, 'response') and e.response is not None: print(f"Response body: {e.response.text}") ``` -------------------------------- ### List Data Request Examples (Shell, Node, Ruby, PHP, Python) Source: https://developers.dovetail.com/reference/data Provides examples of how to make a GET request to the /api/v1/data endpoint using various programming languages and cURL. These examples demonstrate authentication, URL construction, and header specifications. ```shell curl --request GET \ --url https://dovetail.com/api/v1/data \ --header 'accept: application/json' ``` ```node // Node.js example (using fetch) fetch('https://dovetail.com/api/v1/data', { method: 'GET', headers: { 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY' } }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); ``` ```ruby # Ruby example (using Net::HTTP) require 'net/http' require 'uri' uri = URI.parse('https://dovetail.com/api/v1/data') request = Net::HTTP::Get.new(uri) request['Accept'] = 'application/json' request['Authorization'] = 'Bearer YOUR_API_KEY' response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http| http.request(request) end puts JSON.parse(response.body) ``` ```php // PHP example (using cURL) $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://dovetail.com/api/v1/data'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); $headers = [ 'Accept: application/json', 'Authorization: Bearer YOUR_API_KEY' ]; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } else { echo $response; } c_l_close($ch); ``` ```python # Python example (using requests) import requests url = 'https://dovetail.com/api/v1/data' headers = { 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY' } response = requests.get(url, headers=headers) if response.status_code == 200: print(response.json()) else: print(f'Error: {response.status_code} - {response.text}') ``` -------------------------------- ### List Projects (Ruby) Source: https://developers.dovetail.com/reference/projects An example in Ruby demonstrating how to make an HTTP GET request to the Dovetail API for listing projects. It shows the necessary headers and how to process the JSON response. ```ruby require 'uri' require 'net/http' url = URI("https://dovetail.com/api/v1/projects") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["accept"] = "application/json" response = http.request(request) puts response.read_body ``` -------------------------------- ### Get Token Info using Node.js Source: https://developers.dovetail.com/reference/authentication Example code for fetching token information via the Dovetail API using Node.js. This snippet utilizes the 'axios' library to make a GET request to the token info endpoint. Ensure 'axios' is installed (`npm install axios`) before running. ```javascript const axios = require('axios'); const getTokenInfo = async () => { try { const response = await axios.get('https://dovetail.com/api/v1/token/info', { headers: { 'accept': 'application/json' } }); console.log(response.data); return response.data; } catch (error) { console.error('Error fetching token info:', error.response ? error.response.data : error.message); throw error; } }; getTokenInfo(); ``` -------------------------------- ### GET /api/v1/highlights Request (cURL) Source: https://developers.dovetail.com/reference/highlights Demonstrates how to make a GET request to the Dovetail API to list highlights using cURL. This example includes the necessary URL and headers. ```shell curl --request GET \ --url https://dovetail.com/api/v1/highlights \ --header 'accept: application/json' ``` -------------------------------- ### GET /api/v1/highlights Response (200 OK) Source: https://developers.dovetail.com/reference/highlights Provides an example of a successful response (200 OK) when listing highlights from the Dovetail API. It outlines the structure of the returned data, including highlight details and pagination information. ```json { "data": [ { "id": "string", "note_id": "string", "tags": [ { "id": "string", "title": "string" } ], "text": "string", "type": "highlight", "created_at": "string", "updated_at": "string" } ], "page": { "total_count": 0, "has_more": true, "next_cursor": "string" } } ``` -------------------------------- ### List Highlights API with Python Source: https://developers.dovetail.com/reference/highlights Example code snippet for fetching a list of highlights using Python. This utilizes the 'requests' library to make the GET request to the Dovetail API. ```python import requests url = "https://dovetail.com/api/v1/highlights" headers = { "Authorization": "Bearer YOUR_API_TOKEN", "Accept": "application/json" } response = requests.get(url, headers=headers) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code}") print(response.json()) ``` -------------------------------- ### Successful File Response (JSON) Source: https://developers.dovetail.com/reference/files Example JSON structure for a successful (200 OK) response when retrieving file details. It includes the file's ID, name, type, status, author information, and creation timestamp. ```json { "data": { "id": "string", "name": "string", "type": "string", "status": "completed", "author": { "id": "string", "name": "string" }, "created_at": "string" } } ``` -------------------------------- ### List Notes API Response Example (200 OK) Source: https://developers.dovetail.com/reference/notes This is an example of a successful response (HTTP 200) when listing notes via the Dovetail API. It shows the structure of the returned JSON, including the 'data' array with note objects and pagination details. ```json { "data": [ { "id": "string", "type": "note", "title": "string", "created_at": "string", "deleted": true } ], "page": { "total_count": 0, "has_more": true, "next_cursor": "string" } } ``` -------------------------------- ### POST /v1/notes/import/file Source: https://developers.dovetail.com/reference/post_v1-notes-import-file Import a public URL of a file as a new note. Transcription will automatically queue for video or audio files. Returns a new note object. ```APIDOC ## POST /v1/notes/import/file ### Description Import a public url of a file as a new note. If it is a video or audio file, transcription will automatically be queued and run after upload. Returns a new note object. ### Method POST ### Endpoint /v1/notes/import/file ### Parameters #### Query Parameters - **mime_type** (string) - Optional - The nature and format of file want to import. #### Request Body - **project_id** (string) - Required - Unique identifier of the project that the note is associated with. - **title** (string) - Required - The note's title. - **url** (string) - Required - Public url to the file that you want to import. - **fields** (array) - Optional - The note's fields. - **label** (string) - Required - The label of the field. - **value** (string | boolean | number | array[string] | null) - Required - The value of the field. - **type** (string) - Optional - Include the desired type when creating a new field. If omitted or left empty, the field type defaults to TEXT. Do not include this property when referencing an existing field. Enum: ["BOOLEAN", "DATETIME", "EMAIL", "NPS", "NUMBER", "PERSON", "PHONE", "SELECT", "TEXT", "URL"] ### Request Example ```json { "project_id": "string", "title": "My note", "url": "string", "fields": [ { "label": "string", "value": "string | boolean | number | array[string] | null", "type": "BOOLEAN | DATETIME | EMAIL | NPS | NUMBER | PERSON | PHONE | SELECT | TEXT | URL" } ], "mime_type": "string" } ``` ### Response #### Success Response (201) - **data** (object) - The imported note object. - **id** (string) - The unique identifier of the note. - **type** (string) - The type of the object (e.g., "note"). #### Response Example ```json { "data": { "id": "string", "type": "string" } } ``` ``` -------------------------------- ### Get Contact by ID (PHP) Source: https://developers.dovetail.com/reference/contacts Shows a PHP implementation for fetching a contact by ID. This example utilizes cURL to send the GET request to the specified API endpoint. ```php ``` -------------------------------- ### POST /v1/projects Source: https://developers.dovetail.com/reference/post_v1-projects Allows you to create a new project within your Dovetail workspace. Ensure you have the necessary permissions before making this request. The response includes details of the newly created project. ```APIDOC ## POST /v1/projects ### Description Create a project in your Dovetail workspace. Returns the project. > 🚧 Permissions > > Please check you have the relevant permissions required to access this resource. This may include specific permissions on the object itself or its parent, or having the correct user role if you're making updates. ### Method POST ### Endpoint /v1/projects ### Parameters #### Request Body - **title** (string) - Required - The project's title. Maximum length is 200 characters. ### Request Example { "title": "My First Project" } ### Response #### Success Response (201) - **data** (object) - Contains the created project details. - **id** (string) - The unique identifier for the project. - **author** (object) - Information about the project author. - **id** (string) - The author's unique identifier. - **name** (string, nullable) - The author's name. - **title** (string) - The title of the project. - **type** (string) - The type of resource, should be "project". - **created_at** (string) - The timestamp when the project was created. - **deleted** (boolean) - Indicates if the project has been deleted. #### Response Example { "data": { "id": "proj_12345abcde", "author": { "id": "user_abcdef1234", "name": "Jane Doe" }, "title": "My First Project", "type": "project", "created_at": "2024-01-01T10:00:00Z", "deleted": false } } #### Error Response (400) - **errors** (array) - Contains a list of errors. - **code** (string) - Error code (e.g., "InvalidOperation", "ValidationError"). - **title** (string) - A brief title for the error. - **message** (string) - A detailed message describing the error. - **path** (string, optional) - The path to the field that caused the error. #### Response Example (400) { "errors": [ { "code": "ValidationError", "title": "Contract violation", "message": "Title is required." } ] } ``` -------------------------------- ### Get Contact by ID (Ruby) Source: https://developers.dovetail.com/reference/contacts Illustrates how to retrieve a contact by their ID in Ruby. This example uses the built-in 'net/http' library to make the GET request to the Dovetail API. ```ruby require 'net/http' require 'uri' uri = URI.parse('https://dovetail.com/api/v1/contacts/contact_id') request = Net::HTTP::Get.new(uri) request['accept'] = 'application/json' response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end puts response.body ``` -------------------------------- ### Get File by ID (Python) Source: https://developers.dovetail.com/reference/files Example Python code snippet using the 'requests' library to retrieve file information. It demonstrates making a GET request with the necessary 'Accept' header. ```python import requests file_id = 'file_id' url = f"https://dovetail.com/api/v1/files/{file_id}" headers = { 'accept': 'application/json' } try: response = requests.get(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes print(response.json()) except requests.exceptions.RequestException as e: print(f"Error fetching file: {e}") ``` -------------------------------- ### POST /insights Source: https://developers.dovetail.com/reference/post_v1-insights-import-file Imports a file from a public URL as a new insight. If the file is video or audio, transcription is automatically queued. ```APIDOC ## POST /insights ### Description Import a public url of a file as a new insight. If it is a video or audio file, transcription will automatically be queued and run after upload. Returns a new insight object. ### Method POST ### Endpoint /insights ### Parameters #### Query Parameters - **url** (string) - Required - The public URL of the file to import. - **mime_type** (string) - Optional - The MIME type of the file. Required if the URL does not have a file extension. ### Request Body ```json { "url": "https://example.com/path/to/your/file.pdf", "mime_type": "application/pdf" } ``` ### Response #### Success Response (201) - **insight** (object) - The newly created insight object. - **id** (string) - The unique identifier for the insight. - **type** (string) - The type of the insight (e.g., 'file'). - **url** (string) - The original URL of the imported file. - **transcription_status** (string) - The status of the transcription process (e.g., 'queued', 'processing', 'completed', 'failed'). - **created_at** (string) - The timestamp when the insight was created. #### Response Example ```json { "insight": { "id": "insight_12345", "type": "file", "url": "https://example.com/path/to/your/file.pdf", "transcription_status": "queued", "created_at": "2023-10-27T10:00:00Z" } } ``` > 🚧 Permissions > Please check you have the relevant permissions required to access this resource. This may include specific permissions on the object itself or its parent, or having the correct user role if you're making updates. > 🚧 Supported URL's > Only public urls which are linked to a direct download of a file are supported. If the url does not have a file extension, you must provide the `mime_type` parameter. > 📘 Notification > When a transcription is complete or fails, the account linked to the token will be send a notification. You can manage those notifications in the [notifications settings](https://dovetail.com/settings/user/notifications). ``` -------------------------------- ### List Projects (Python) Source: https://developers.dovetail.com/reference/projects A Python example using the `requests` library to fetch a list of projects from the Dovetail API. It demonstrates setting the `accept` header and printing the JSON response. ```python import requests url = "https://dovetail.com/api/v1/projects" headers = { "accept": "application/json" } response = requests.get(url, headers=headers) print(response.text) ``` -------------------------------- ### Get File by ID (Ruby) Source: https://developers.dovetail.com/reference/files Example Ruby code snippet using the 'httparty' gem to perform a GET request for file details. It shows how to specify the URL and accept headers. ```ruby require 'httparty' url = 'https://dovetail.com/api/v1/files/file_id' response = HTTParty.get(url, headers: { 'accept' => 'application/json' }) if response.success? puts response.parsed_response else puts "Error: #{response.code} - #{response.message}" end ``` -------------------------------- ### List Projects (Node.js) Source: https://developers.dovetail.com/reference/projects Provides a Node.js example using a generic HTTP client to fetch a list of projects from the Dovetail API. It outlines the request structure and handling of the JSON response. ```javascript const http = require('http'); const options = { method: 'GET', hostname: 'dovetail.com', port: null, path: '/api/v1/projects', headers: { 'accept': 'application/json' } }; 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(); ``` -------------------------------- ### Get File by ID (PHP) Source: https://developers.dovetail.com/reference/files Example PHP code snippet using cURL to fetch file details. It configures the cURL request to perform a GET operation and set the appropriate headers. ```php ``` -------------------------------- ### POST /websites/developers_dovetail_reference/topics Source: https://developers.dovetail.com/reference/post_v1-channels-topic Creates a new topic with a title and description in a specified channel. The newly created topic object is returned upon successful creation. ```APIDOC ## POST /websites/developers_dovetail_reference/topics ### Description Create a topic with title and description in a specified channel. Returns the topic object. ### Method POST ### Endpoint /websites/developers_dovetail_reference/topics ### Parameters #### Query Parameters - **channel_id** (string) - Required - The ID of the channel where the topic will be created. #### Request Body - **title** (string) - Required - The title of the topic. - **description** (string) - Optional - A detailed description for the topic. ### Request Example ```json { "title": "New Feature Discussion", "description": "Discussing the implementation details for the upcoming user profile update." } ``` ### Response #### Success Response (201 Created) - **id** (string) - The unique identifier for the created topic. - **title** (string) - The title of the topic. - **description** (string) - The description of the topic. - **channel_id** (string) - The ID of the channel the topic belongs to. - **created_at** (string) - The timestamp when the topic was created. #### Response Example ```json { "id": "topic_abc123", "title": "New Feature Discussion", "description": "Discussing the implementation details for the upcoming user profile update.", "channel_id": "channel_xyz789", "created_at": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Get File by ID (Node.js) Source: https://developers.dovetail.com/reference/files Example Node.js code snippet using the 'axios' library to make a GET request to retrieve file details. It demonstrates how to set the request URL and headers. ```javascript const axios = require('axios'); const getFileById = async (fileId) => { try { const response = await axios.get(`https://dovetail.com/api/v1/files/${fileId}`, { headers: { 'accept': 'application/json' } }); return response.data; } catch (error) { console.error('Error fetching file:', error); throw error; } }; // Example usage: // getFileById('your_file_id').then(data => console.log(data)); ``` -------------------------------- ### Get File by ID (cURL) Source: https://developers.dovetail.com/reference/files Example cURL command to fetch a file's details using its ID. It specifies the GET request, the endpoint URL, and the desired JSON content type. ```shell curl --request GET \ --url https://dovetail.com/api/v1/files/file_id \ --header 'accept: application/json' ``` -------------------------------- ### List Tags - Node.js Request Source: https://developers.dovetail.com/reference/tags Example of how to fetch a list of tags using Node.js with the 'node-fetch' library. This demonstrates setting up the request URL and headers. ```javascript const fetch = require('node-fetch'); const url = 'https://dovetail.com/api/v1/tags'; fetch(url, { method: 'GET', headers: { 'accept': 'application/json' } }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error(error)); ``` -------------------------------- ### List Highlights API with Node.js Source: https://developers.dovetail.com/reference/highlights Example code snippet for fetching a list of highlights using Node.js. This requires the 'axios' library for making HTTP requests and assumes you have your API credentials set up. ```javascript const axios = require('axios'); const getHighlights = async () => { try { const response = await axios.get('https://dovetail.com/api/v1/highlights', { headers: { 'Authorization': 'Bearer YOUR_API_TOKEN', 'Accept': 'application/json' } }); return response.data; } catch (error) { console.error('Error fetching highlights:', error); throw error; } }; getHighlights().then(data => console.log(data)); ``` -------------------------------- ### POST /v1/channels/topic Source: https://developers.dovetail.com/reference/post_v1-channels-topic Creates a new topic within a specified channel. This endpoint allows users to create topics by providing a title, description, and the channel ID. It returns the newly created topic object upon successful creation. ```APIDOC ## POST /v1/channels/topic ### Description Creates a new topic within a specified channel. This endpoint allows users to create topics by providing a title, description, and the channel ID. It returns the newly created topic object upon successful creation. ### Method POST ### Endpoint /v1/channels/topic ### Parameters #### Query Parameters None #### Request Body - **title** (string) - Required - The topic's title. Must be between 1 and 300 characters. - **description** (string) - Required - The topic's description. Must be between 1 and 2500 characters. - **channel_id** (string) - Required - Unique identifier of the channel. ### Request Example ```json { "title": "New Topic Title", "description": "This is the description for the new topic.", "channel_id": "channel-123" } ``` ### Response #### Success Response (201) - **data** (object) - Contains the created topic details. - **id** (string) - The unique identifier of the topic. - **title** (string) - The title of the topic. - **description** (string) - The description of the topic. - **channel** (object) - Information about the channel the topic belongs to. - **id** (string) - The unique identifier of the channel. - **created_at** (string) - The timestamp when the topic was created. #### Response Example ```json { "data": { "id": "topic-abc", "title": "New Topic Title", "description": "This is the description for the new topic.", "channel": { "id": "channel-123" }, "created_at": "2023-10-27T10:00:00Z" } } ``` #### Error Response (400) - **errors** (array) - A list of errors that occurred during the request. - **code** (string) - The error code (e.g., "InvalidOperation", "ValidationError"). - **title** (string) - A short title for the error. - **message** (string) - A detailed message explaining the error. - **path** (string) - The path to the field that caused the error (if applicable). ``` -------------------------------- ### Get Contact by ID (Node.js) Source: https://developers.dovetail.com/reference/contacts Provides a Node.js example for fetching a contact by ID using the Dovetail API. It assumes the use of a library like 'axios' for making HTTP requests and includes basic error handling. ```javascript const axios = require('axios'); const getContact = async (contactId) => { try { const response = await axios.get(`https://dovetail.com/api/v1/contacts/${contactId}`, { headers: { 'accept': 'application/json' } }); return response.data; } catch (error) { console.error('Error fetching contact:', error); throw error; } }; // Example usage: // getContact('some_contact_id').then(data => console.log(data)); ``` -------------------------------- ### GET /v1/projects/{project_id} Source: https://developers.dovetail.com/reference/get_v1-projects-project-id Retrieves a specific project using its unique identifier. Ensure you have the necessary permissions to access this resource. ```APIDOC ## GET /v1/projects/{project_id} ### Description Get a project by id. Users must have the relevant permissions to access this resource, which may include specific permissions on the object itself or its parent, or having the correct user role if making updates. ### Method GET ### Endpoint /v1/projects/{project_id} ### Parameters #### Path Parameters - **project_id** (string) - Required - Unique identifier of the project. ### Request Example ```json { "example": "request body not applicable for GET" } ``` ### Response #### Success Response (200) - **data** (object) - Contains the project details. - **id** (string) - The unique identifier of the project. - **author** (object | null) - Information about the project author. - **id** (string) - The author's unique identifier. - **name** (string | null) - The author's name. - **title** (string) - The title of the project. - **type** (string) - The type of resource, should be 'project'. - **created_at** (string) - The timestamp when the project was created. - **deleted** (boolean) - Indicates if the project has been deleted. #### Response Example ```json { "data": { "id": "project_123", "author": { "id": "user_abc", "name": "John Doe" }, "title": "Example Project", "type": "project", "created_at": "2023-10-27T10:00:00Z", "deleted": false } } ``` #### Error Response (400) - **errors** (array) - A list of errors. - **code** (string) - The error code, e.g., 'ValidationError'. - **title** (string) - The error title, e.g., 'Contract violation'. - **message** (string) - A descriptive error message. - **path** (string) - The path to the field that caused the error. #### Error Response (401) - **errors** (array) - A list of errors. - **code** (string) - The error code, e.g., 'Unauthorized'. - **title** (string) - The error title. - **message** (string) - A descriptive error message. ``` -------------------------------- ### Get Token Info using Node.js Source: https://developers.dovetail.com/reference/index Example of fetching token information via the Dovetail API using Node.js. This typically involves using a library like 'axios' or the built-in 'fetch' to make a GET request to the token info endpoint. ```javascript async function getTokenInfo() { const response = await fetch('https://dovetail.com/api/v1/token/info', { method: 'GET', headers: { 'accept': 'application/json' } }); const data = await response.json(); return data; } ``` -------------------------------- ### List Projects Source: https://developers.dovetail.com/reference/get_v1-contacts Retrieves a list of projects available within the Dovetail Developers Reference. Supports pagination and filtering. ```APIDOC ## GET /websites/developers_dovetail_reference ### Description Retrieves a list of projects. This endpoint supports pagination. ### Method GET ### Endpoint /websites/developers_dovetail_reference ### Query Parameters - **page** (integer) - Optional - Specifies the page number for pagination. - **limit** (integer) - Optional - Specifies the number of items per page. ### Response #### Success Response (200) - **data** (array) - Contains a list of project objects. - **id** (string) - Unique identifier for the project. - **name** (string) - Name of the project. - **created_at** (string) - Timestamp when the project was created. - **fields** (array) - List of fields associated with the project. - **label** (string) - The display name for the field. - **value** (string or array) - The value of the field. Can be a string or an array of strings. - **type** (string) - The type of the field. Enum: BOOLEAN, DATETIME, EMAIL, NPS, NUMBER, PERSON, PHONE, SELECT, TEXT, URL. Defaults to TEXT if omitted. - **page** (object) - Pagination information. - **total_count** (number) - Total number of items available. - **has_more** (boolean) - Indicates if there are more pages. - **next_cursor** (string) - Cursor for fetching the next page. #### Response Example ```json { "data": [ { "id": "proj_123", "name": "User Feedback Project", "created_at": "2023-10-27T10:00:00Z", "fields": [ { "label": "User Sentiment", "value": ["Positive", "Neutral", "Negative"], "type": "SELECT" }, { "label": "Feedback Details", "value": "", "type": "TEXT" } ] } ], "page": { "total_count": 10, "has_more": true, "next_cursor": "cursor_abc123" } } ``` #### Error Response (400) - **errors** (array) - Contains a list of error objects. - **code** (string) - Error code. Enum: ValidationError. - **title** (string) - Error title. Enum: Contract violation. - **message** (string) - Detailed error message. - **path** (string) - The path to the field that caused the error. #### Error Response Example (400) ```json { "errors": [ { "code": "ValidationError", "title": "Contract violation", "message": "Invalid value provided for 'limit' parameter.", "path": "limit" } ] } ``` #### Error Response (401) - **errors** (array) - Contains a list of error objects. - **code** (string) - Error code. Enum: Unauthorized. - **title** (string) - Error title. - **message** (string) - Detailed error message. ``` -------------------------------- ### POST /v1/data/import/file Source: https://developers.dovetail.com/reference/post_v1-data-import-file Imports a file from a public URL into Dovetail as new data. Supports automatic transcription for audio/video files and allows for custom field mapping. ```APIDOC ## POST /v1/data/import/file ### Description Imports a public URL of a file as a new data entry. If the file is video or audio, transcription will be queued automatically after upload. This endpoint returns a new data object. **Permissions**: Ensure you have the necessary permissions to access this resource. **Supported URLs**: Only public URLs directly linked to a file download are supported. If the URL lacks a file extension, `mime_type` must be provided. **Fields**: Only existing and unique fields can be used. New fields are not created, and duplicates are not differentiated. **Notification**: The account linked to the token will receive notifications upon transcription completion or failure. Manage notifications in your [settings](https://dovetail.com/settings/user/notifications). ### Method POST ### Endpoint `/v1/data/import/file` ### Parameters #### Query Parameters * **mime_type** (string) - Optional - The nature and format of the file you want to import. Required if the URL does not have a file extension. #### Request Body - **project_id** (string) - Required - Unique identifier of the project the data is associated with. - **title** (string) - Required - The title of the data entry. - **url** (string) - Required - Public URL to the file to import. - **fields** (array) - Optional - An array of field objects, each with a `label` and `value`. The `type` of the field can also be specified. - **label** (string) - Required - The name of the field. - **value** (string | boolean | number | array | null) - Required - The value of the field. - **type** (string) - Optional - The type of the field. Enum: `BOOLEAN`, `DATETIME`, `EMAIL`, `NPS`, `NUMBER`, `PERSON`, `PHONE`, `SELECT`, `TEXT`, `URL`. Defaults to `TEXT` if omitted. - **mime_type** (string) - Optional - The nature and format of the file want to import. - **created_at** (string) - Optional - The creation date and time to associate with the file, in ISO 8601 format. Example: `2023-10-01T12:00:00Z`. - **author_id** (string) - Optional - Unique identifier of the Dovetail user associated with the file. ### Request Example ```json { "project_id": "your_project_id", "title": "My imported document", "url": "https://example.com/path/to/your/file.pdf", "fields": [ { "label": "Document Type", "value": "Report", "type": "SELECT" }, { "label": "Keywords", "value": ["api", "documentation", "import"], "type": "TEXT" } ], "mime_type": "application/pdf", "created_at": "2023-10-26T10:00:00Z", "author_id": "user_abc123" } ``` ### Response #### Success Response (201) - **data** (object) - The newly created data object, including its ID and imported details. #### Response Example ```json { "data": { "id": "data_xyz789", "title": "My imported document", "project_id": "your_project_id", "created_at": "2023-10-26T10:00:00Z", "author_id": "user_abc123", "fields": [ { "label": "Document Type", "value": "Report", "type": "SELECT" }, { "label": "Keywords", "value": ["api", "documentation", "import"], "type": "TEXT" } ] } } ``` ``` -------------------------------- ### List Tags - Python Request Source: https://developers.dovetail.com/reference/tags Example using Python's 'requests' library to make a GET request to the Dovetail API for listing tags. It includes setting the 'accept' header. ```python import requests url = 'https://dovetail.com/api/v1/tags' headers = { 'accept': 'application/json' } response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### List Highlights API with PHP Source: https://developers.dovetail.com/reference/highlights Example code snippet for fetching a list of highlights using PHP. This uses cURL to make the GET request to the Dovetail API and retrieve the JSON response. ```php ``` -------------------------------- ### Create Channel via API (cURL) Source: https://developers.dovetail.com/reference/channels This example demonstrates how to create a channel using a POST request to the Dovetail API. It requires specifying the channel's title and content type in the request body. The response includes details of the created channel or error information. ```shell curl --request POST \ --url https://dovetail.com/api/v1/channels \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --data '{ "content_type": "APP_REVIEW" }' ``` -------------------------------- ### List Tags - Ruby Request Source: https://developers.dovetail.com/reference/tags An example of making a GET request to the Dovetail API to list tags using Ruby's built-in Net::HTTP library. It shows how to construct the request and handle the response. ```ruby require 'net/http' require 'uri' uri = URI.parse('https://dovetail.com/api/v1/tags') response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http| request = Net::HTTP::Get.new(uri) request['accept'] = 'application/json' http.request(request) end puts response.body ``` -------------------------------- ### List Highlights API with Ruby Source: https://developers.dovetail.com/reference/highlights Example code snippet for fetching a list of highlights using Ruby. This uses the 'net/http' library for making HTTP requests to the Dovetail API. ```ruby require 'net/http' require 'uri' uri = URI.parse("https://dovetail.com/api/v1/highlights") request = Net::HTTP::Get.new(uri) request["Accept"] = "application/json" request["Authorization"] = "Bearer YOUR_API_TOKEN" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end puts response.body ```