From 1787393cbc8f922378e28832e807b582e69c5f84 Mon Sep 17 00:00:00 2001 From: Andrew <47720952+andrewhong5297@users.noreply.github.com> Date: Fri, 12 Jan 2024 11:04:47 -0500 Subject: [PATCH 1/8] crud endpoints --- api-reference/crud.json | 1140 +++++++++++++++++++++++++++++ api-reference/crud/archive.mdx | 4 + api-reference/crud/create.mdx | 4 + api-reference/crud/private.mdx | 4 + api-reference/crud/read.mdx | 4 + api-reference/crud/unarchive.mdx | 4 + api-reference/crud/unprivate.mdx | 4 + api-reference/crud/update.mdx | 4 + api-reference/endpoint/create.mdx | 13 - api-reference/endpoint/delete.mdx | 4 - api-reference/endpoint/get.mdx | 4 - 11 files changed, 1168 insertions(+), 21 deletions(-) create mode 100644 api-reference/crud.json create mode 100644 api-reference/crud/archive.mdx create mode 100644 api-reference/crud/create.mdx create mode 100644 api-reference/crud/private.mdx create mode 100644 api-reference/crud/read.mdx create mode 100644 api-reference/crud/unarchive.mdx create mode 100644 api-reference/crud/unprivate.mdx create mode 100644 api-reference/crud/update.mdx delete mode 100644 api-reference/endpoint/create.mdx delete mode 100644 api-reference/endpoint/delete.mdx delete mode 100644 api-reference/endpoint/get.mdx diff --git a/api-reference/crud.json b/api-reference/crud.json new file mode 100644 index 00000000..26bebb0c --- /dev/null +++ b/api-reference/crud.json @@ -0,0 +1,1140 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "OpenAPI for CRUD API", + "description": "API for create, read, update, and delete operations on Dune queries.", + "version": "1.0.0" + }, + "servers": [ + { + "url": "https://api.dune.com/api" + } + ], + "paths": { + "/v1/query/{queryId}": { + "get": { + "summary": "Returns the details of a query on Dune", + "description": "This API allows for anyone to read the sql text, parameters, name, tags, and state of a query. For private queries, only the API key generated under the context of the owner of that query will work.", + "operationId": "GetQuery", + "parameters": [ + { + "in": "header", + "name": "X-DUNE-API-KEY", + "schema": { + "type": "string" + }, + "description": "API Key for accessing this service", + "required": true + }, + { + "in": "path", + "name": "queryId", + "required": true, + "schema": { + "type": "integer" + }, + "description": "unique identifier of the query" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetQueryResponse" + } + } + } + }, + "400": { + "description": "Bad Request - The request could not be understood by the server due to malformed syntax or validation failure.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "error": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string", + "example": "Core request validation failed" + } + } + } + } + } + }, + "404": { + "description": "Resource not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + }, + "500": { + "description": "Internal server error occurred. This usually happens due to unexpected issues in processing the request. It may include errors such as failure in core API execution, invalid query parameters, or issues with the customer data provided.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InternalServerError" + } + } + } + } + } + } + + , "patch": { + "summary": "Update the details of a query on Dune", + "description": "This API allows for anyone to update the sql text, parameters, name, tags, and state of a query. Only the API key generated under the context of the owner of that query will work.", + "operationId": "UpdateQuery", + "parameters": [ + { + "in": "header", + "name": "X-DUNE-API-KEY", + "schema": { + "type": "string" + }, + "description": "API Key for accessing this service", + "required": true + }, + { + "in": "path", + "name": "queryId", + "required": true, + "schema": { + "type": "integer" + }, + "description": "unique identifier of the query" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateQueryRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "query_id": { + "type": "integer", + "format": "int32", + "example": 1616880 + } + } + } + } + } + }, + "400": { + "description": "Bad Request - The request could not be understood by the server due to malformed syntax or validation failure.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "error": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string", + "example": "Core request validation failed" + } + } + } + } + } + }, + "404": { + "description": "Resource not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + }, + "500": { + "description": "Internal server error occurred. This usually happens due to unexpected issues in processing the request. It may include errors such as failure in core API execution, invalid query parameters, or issues with the customer data provided.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InternalServerError" + } + } + } + } + } + } + } + , "/v1/query/": { + "post": { + "summary": "Create and save a query on Dune", + "description": "This API allows for anyone to create a query. The owner of the query will be under the context of the API key.", + "operationId": "CreateQuery", + "parameters": [ + { + "in": "header", + "name": "X-DUNE-API-KEY", + "schema": { + "type": "string" + }, + "description": "API Key for accessing this service", + "required": true + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateQueryRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "query_id": { + "type": "integer", + "format": "int32", + "example": 1616880 + } + } + } + } + } + }, + "400": { + "description": "Bad Request - The request could not be understood by the server due to malformed syntax or validation failure.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "error": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string", + "example": "Core request validation failed" + } + } + } + } + } + }, + "404": { + "description": "Resource not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + }, + "500": { + "description": "Internal server error occurred. This usually happens due to unexpected issues in processing the request. It may include errors such as failure in core API execution, invalid query parameters, or issues with the customer data provided.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InternalServerError" + } + } + } + } + } + } + } + + , "/v1/query/{queryId}/archive": { + "post": { + "summary": "Archive a query on Dune", + "description": "This API allows for anyone to archive a query. Only the API key generated under the context of the owner of that query will work. This does not delete the query, but will make it uneditable/unexecutable", + "operationId": "archive", + "parameters": [ + { + "in": "header", + "name": "X-DUNE-API-KEY", + "schema": { + "type": "string" + }, + "description": "API Key for accessing this service", + "required": true + }, + { + "in": "path", + "name": "queryId", + "required": true, + "schema": { + "type": "integer" + }, + "description": "unique identifier of the query" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "query_id": { + "type": "integer", + "format": "int32", + "example": 1616880 + } + } + } + } + } + }, + "400": { + "description": "Bad Request - The request could not be understood by the server due to malformed syntax or validation failure.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "error": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string", + "example": "Core request validation failed" + } + } + } + } + } + }, + "404": { + "description": "Resource not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + }, + "500": { + "description": "Internal server error occurred. This usually happens due to unexpected issues in processing the request. It may include errors such as failure in core API execution, invalid query parameters, or issues with the customer data provided.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InternalServerError" + } + } + } + } + } + } + } + + , "/v1/query/{queryId}/unarchive": { + "post": { + "summary": "Unarchive a query on Dune", + "description": "This API allows for anyone to unarchive a query. Only the API key generated under the context of the owner of that query will work.", + "operationId": "unarchive", + "parameters": [ + { + "in": "header", + "name": "X-DUNE-API-KEY", + "schema": { + "type": "string" + }, + "description": "API Key for accessing this service", + "required": true + }, + { + "in": "path", + "name": "queryId", + "required": true, + "schema": { + "type": "integer" + }, + "description": "unique identifier of the query" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "query_id": { + "type": "integer", + "format": "int32", + "example": 1616880 + } + } + } + } + } + }, + "400": { + "description": "Bad Request - The request could not be understood by the server due to malformed syntax or validation failure.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "error": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string", + "example": "Core request validation failed" + } + } + } + } + } + }, + "404": { + "description": "Resource not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + }, + "500": { + "description": "Internal server error occurred. This usually happens due to unexpected issues in processing the request. It may include errors such as failure in core API execution, invalid query parameters, or issues with the customer data provided.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InternalServerError" + } + } + } + } + } + } + } + + , "/v1/query/{queryId}/private": { + "post": { + "summary": "Private a query on Dune", + "description": "This API allows for anyone to private a query. Only the API key generated under the context of the owner of that query will work.", + "operationId": "private", + "parameters": [ + { + "in": "header", + "name": "X-DUNE-API-KEY", + "schema": { + "type": "string" + }, + "description": "API Key for accessing this service", + "required": true + }, + { + "in": "path", + "name": "queryId", + "required": true, + "schema": { + "type": "integer" + }, + "description": "unique identifier of the query" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "query_id": { + "type": "integer", + "format": "int32", + "example": 1616880 + } + } + } + } + } + }, + "400": { + "description": "Bad Request - The request could not be understood by the server due to malformed syntax or validation failure.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "error": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string", + "example": "Core request validation failed" + } + } + } + } + } + }, + "404": { + "description": "Resource not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + }, + "500": { + "description": "Internal server error occurred. This usually happens due to unexpected issues in processing the request. It may include errors such as failure in core API execution, invalid query parameters, or issues with the customer data provided.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InternalServerError" + } + } + } + } + } + } + } + + , "/v1/query/{queryId}/unprivate": { + "post": { + "summary": "Private a query on Dune", + "description": "This API allows for anyone to unprivate a query. Only the API key generated under the context of the owner of that query will work.", + "operationId": "unprivate", + "parameters": [ + { + "in": "header", + "name": "X-DUNE-API-KEY", + "schema": { + "type": "string" + }, + "description": "API Key for accessing this service", + "required": true + }, + { + "in": "path", + "name": "queryId", + "required": true, + "schema": { + "type": "integer" + }, + "description": "unique identifier of the query" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "query_id": { + "type": "integer", + "format": "int32", + "example": 1616880 + } + } + } + } + } + }, + "400": { + "description": "Bad Request - The request could not be understood by the server due to malformed syntax or validation failure.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "error": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string", + "example": "Core request validation failed" + } + } + } + } + } + }, + "404": { + "description": "Resource not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + }, + "500": { + "description": "Internal server error occurred. This usually happens due to unexpected issues in processing the request. It may include errors such as failure in core API execution, invalid query parameters, or issues with the customer data provided.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InternalServerError" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "GetQueryResponse": { + "type": "object", + "properties": { + "query_id": { + "type": "integer" + ,"description": "Unique identifier of the query." + ,"example": 1252207 + }, + "name": { + "type": "string" + ,"description": "Name of the query." + ,"example": "erc20 balances (user address) API" + }, + "description": { + "type": "string" + ,"description": "Description of the query." + ,"example": "Get the ERC20 token balances for a given user address." + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + ,"description": "Tags associated with the query." + ,"example": ["erc20", "balances", "user address"] + }, + "version": { + "type": "integer" + ,"description": "Version of the query." + ,"example": 17 + }, + "parameters": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ParameterObject" + } + ,"example": [ + { + "key": "address", + "value": "0x2ae8c972fb2e6c00dded8986e2dc672ed190da06", + "type": "text" + }, + { + "key": "blocknumber", + "value": "0", + "type": "number" + }, + { + "key": "chain", + "value": "ethereum", + "type": "enum", + "enumOptions": [ + "ethereum", + "polygon", + "optimism", + "arbitrum", + "avalanche_c", + "gnosis", + "bnb" + ] + }, + { + "key": "dust", + "value": "keep", + "type": "enum", + "enumOptions": [ + "keep", + "remove" + ] + } + ] + }, + "query_engine": { + "type": "string" + ,"description": "The query engine used to execute the query." + ,"example": "v2 Dune SQL" + }, + "query_sql": { + "type": "string" + ,"description": "The SQL query text." + ,"example": "with\n erc20_balances as (\n WITH erc20_in as ( \n SELECT \n contract_address\n , SUM(tr.value) as token_funded\n FROM erc20_{{chain}}.evt_Transfer tr\n WHERE tr.to = {{address}}\n AND ({{blocknumber}} = 0 OR tr.evt_block_number <= {{blocknumber}})\n GROUP BY 1\n ),\n \n erc20_out as (\n SELECT \n contract_address\n , SUM(tr.value) as token_spent\n FROM erc20_{{chain}}.evt_Transfer tr\n WHERE tr.\"from\" = {{address}}\n AND ({{blocknumber}} = 0 OR tr.evt_block_number <= {{blocknumber}})\n GROUP BY 1\n )\n \n SELECT\n tk.symbol as symbol\n , erc20_in.contract_address\n , (cast(token_funded as double) - COALESCE(cast(token_spent as double), 0))/pow(10,COALESCE(tk.decimals,18)) as balance\n FROM erc20_in\n LEFT JOIN erc20_out ON erc20_in.contract_address = erc20_out.contract_address\n LEFT JOIN tokens.erc20 tk ON tk.contract_address = erc20_in.contract_address\n WHERE cast(token_funded as double) - COALESCE(cast(token_spent as double), 0) > 0\n -- WHERE tk.symbol is not null\n )\n\nSELECT\n bal.symbol\n , round(bal.balance,5) as notional_value\n , round(bal.balance*p.price,3) as total_value\n , p.price as token_price\nFROM erc20_balances bal\nLEFT JOIN prices.usd_latest p \n ON p.contract_address = bal.contract_address\n AND p.blockchain = '{{chain}}' --AND p.rn = 1 \nWHERE bal.balance > 0\nAND ('{{dust}}' = 'keep' OR bal.balance*p.price > 0.01)\nORDER BY total_value DESC\nNULLS LAST" + }, + "is_private": { + "type": "boolean" + ,"description": "Indicates if the query is private." + ,"example": false + }, + "is_archived": { + "type": "boolean" + ,"description": "Indicates if the query is archived." + ,"example": false + }, + "is_unsaved": { + "type": "boolean" + ,"description": "Indicates if the query is unsaved." + ,"example": false + }, + "owner": { + "type": "string" + ,"description": "The owner of the query." + ,"example": "Dune" + } + } + } + , "UpdateQueryRequest": { + "type": "object", + "properties": { + "query_id": { + "type": "integer" + ,"description": "Unique identifier of the query." + ,"example": 1252207 + }, + "name": { + "type": "string" + ,"description": "Name of the query." + ,"example": "erc20 balances (user address) API" + }, + "description": { + "type": "string" + ,"description": "Description of the query." + ,"example": "Get the ERC20 token balances for a given user address." + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + ,"description": "Tags associated with the query." + ,"example": ["erc20", "balances", "user address"] + }, + "parameters": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ParameterObject" + } + ,"example": [ + { + "key": "address", + "value": "0x2ae8c972fb2e6c00dded8986e2dc672ed190da06", + "type": "text" + }, + { + "key": "blocknumber", + "value": "0", + "type": "number" + }, + { + "key": "chain", + "value": "ethereum", + "type": "enum", + "enumOptions": [ + "ethereum", + "polygon", + "optimism", + "arbitrum", + "avalanche_c", + "gnosis", + "bnb" + ] + }, + { + "key": "dust", + "value": "keep", + "type": "enum", + "enumOptions": [ + "keep", + "remove" + ] + } + ] + }, + "query_sql": { + "type": "string" + ,"description": "The SQL query text." + ,"example": "with\n erc20_balances as (\n WITH erc20_in as ( \n SELECT \n contract_address\n , SUM(tr.value) as token_funded\n FROM erc20_{{chain}}.evt_Transfer tr\n WHERE tr.to = {{address}}\n AND ({{blocknumber}} = 0 OR tr.evt_block_number <= {{blocknumber}})\n GROUP BY 1\n ),\n \n erc20_out as (\n SELECT \n contract_address\n , SUM(tr.value) as token_spent\n FROM erc20_{{chain}}.evt_Transfer tr\n WHERE tr.\"from\" = {{address}}\n AND ({{blocknumber}} = 0 OR tr.evt_block_number <= {{blocknumber}})\n GROUP BY 1\n )\n \n SELECT\n tk.symbol as symbol\n , erc20_in.contract_address\n , (cast(token_funded as double) - COALESCE(cast(token_spent as double), 0))/pow(10,COALESCE(tk.decimals,18)) as balance\n FROM erc20_in\n LEFT JOIN erc20_out ON erc20_in.contract_address = erc20_out.contract_address\n LEFT JOIN tokens.erc20 tk ON tk.contract_address = erc20_in.contract_address\n WHERE cast(token_funded as double) - COALESCE(cast(token_spent as double), 0) > 0\n -- WHERE tk.symbol is not null\n )\n\nSELECT\n bal.symbol\n , round(bal.balance,5) as notional_value\n , round(bal.balance*p.price,3) as total_value\n , p.price as token_price\nFROM erc20_balances bal\nLEFT JOIN prices.usd_latest p \n ON p.contract_address = bal.contract_address\n AND p.blockchain = '{{chain}}' --AND p.rn = 1 \nWHERE bal.balance > 0\nAND ('{{dust}}' = 'keep' OR bal.balance*p.price > 0.01)\nORDER BY total_value DESC\nNULLS LAST" + }, + "is_private": { + "type": "boolean" + ,"description": "Indicates if the query is private." + ,"example": false + }, + "is_archived": { + "type": "boolean" + ,"description": "Indicates if the query is archived." + ,"example": false + } + } + } + , "CreateQueryRequest": { + "type": "object", + "properties": { + "name": { + "type": "string" + ,"description": "Name of the query." + ,"example": "erc20 balances (user address) API" + }, + "description": { + "type": "string" + ,"description": "Description of the query." + ,"example": "Get the ERC20 token balances for a given user address." + }, + "parameters": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ParameterObject" + } + ,"example": [ + { + "key": "address", + "value": "0x2ae8c972fb2e6c00dded8986e2dc672ed190da06", + "type": "text" + }, + { + "key": "blocknumber", + "value": "0", + "type": "number" + }, + { + "key": "chain", + "value": "ethereum", + "type": "enum", + "enumOptions": [ + "ethereum", + "polygon", + "optimism", + "arbitrum", + "avalanche_c", + "gnosis", + "bnb" + ] + }, + { + "key": "dust", + "value": "keep", + "type": "enum", + "enumOptions": [ + "keep", + "remove" + ] + } + ] + }, + "query_sql": { + "type": "string" + ,"description": "The SQL query text." + ,"example": "with\n erc20_balances as (\n WITH erc20_in as ( \n SELECT \n contract_address\n , SUM(tr.value) as token_funded\n FROM erc20_{{chain}}.evt_Transfer tr\n WHERE tr.to = {{address}}\n AND ({{blocknumber}} = 0 OR tr.evt_block_number <= {{blocknumber}})\n GROUP BY 1\n ),\n \n erc20_out as (\n SELECT \n contract_address\n , SUM(tr.value) as token_spent\n FROM erc20_{{chain}}.evt_Transfer tr\n WHERE tr.\"from\" = {{address}}\n AND ({{blocknumber}} = 0 OR tr.evt_block_number <= {{blocknumber}})\n GROUP BY 1\n )\n \n SELECT\n tk.symbol as symbol\n , erc20_in.contract_address\n , (cast(token_funded as double) - COALESCE(cast(token_spent as double), 0))/pow(10,COALESCE(tk.decimals,18)) as balance\n FROM erc20_in\n LEFT JOIN erc20_out ON erc20_in.contract_address = erc20_out.contract_address\n LEFT JOIN tokens.erc20 tk ON tk.contract_address = erc20_in.contract_address\n WHERE cast(token_funded as double) - COALESCE(cast(token_spent as double), 0) > 0\n -- WHERE tk.symbol is not null\n )\n\nSELECT\n bal.symbol\n , round(bal.balance,5) as notional_value\n , round(bal.balance*p.price,3) as total_value\n , p.price as token_price\nFROM erc20_balances bal\nLEFT JOIN prices.usd_latest p \n ON p.contract_address = bal.contract_address\n AND p.blockchain = '{{chain}}' --AND p.rn = 1 \nWHERE bal.balance > 0\nAND ('{{dust}}' = 'keep' OR bal.balance*p.price > 0.01)\nORDER BY total_value DESC\nNULLS LAST" + }, + "is_private": { + "type": "boolean" + ,"description": "Indicates if the query is private." + ,"example": false + } + } + } + ,"QueryResult": { + "type": "object", + "required": [ + "executionId", + "queryId", + "state", + "submitted_at" + ], + "properties": { + "executionId": { + "type": "string", + "description": "Unique identifier for the execution of the query.", + "example": "01GXDTYMM2CKFRBEW44X5S0WZE" + }, + "queryId": { + "type": "integer", + "description": "Unique identifier of the query.", + "example": 1252207 + }, + "state": { + "type": "string", + "description": "The state of the query execution.", + "example": "QUERY_STATE_COMPLETED" + }, + "submitted_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp of when the query was submitted.", + "example": "2023-04-07T12:27:09.314513Z" + }, + "expires_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp of when the query result expires.", + "example": "2025-04-06T12:27:15.749155Z" + }, + "execution_started_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp of when the query execution started.", + "example": "2023-04-07T12:27:09.387366Z" + }, + "execution_ended_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp of when the query execution ended.", + "example": "2023-04-07T12:27:15.749154Z" + }, + "cancelled_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp of when the query execution was cancelled, if applicable.", + "example": "2023-04-08T12:27:15.749154Z" + }, + "result": { + "$ref": "#/components/schemas/QueryResultData" + }, + "error": { + "$ref": "#/components/schemas/QueryResultError" + } + } + }, + "QueryResultData": { + "type": "object", + "properties": { + "rows": { + "type": "array", + "items": { + "$ref": "#/components/schemas/QueryResultRow" + }, + "description": "The rows of data returned by the query." + }, + "metadata": { + "$ref": "#/components/schemas/ExecutionResultMetadata" + } + } + }, + "QueryResultError": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The type of error that occurred." + }, + "message": { + "type": "string", + "description": "A descriptive message about the error." + }, + "metadata": { + "$ref": "#/components/schemas/SyntaxErrorMetadata" + } + } + }, + "QueryResultRow": { + "type": "object", + "description": "A row is dictionary of key-value pairs, each pair corresponding to a column", + "example": [ + { + "TableName": "eth_blocks", + "ct": 6296 + }, + { + "TableName": "eth_traces", + "ct": 4474223 + } + ] + }, + "SyntaxErrorMetadata": { + "type": "object", + "properties": { + "line": { + "type": "integer", + "description": "The line number at which the syntax error occurred." + }, + "column": { + "type": "integer", + "description": "The column number at which the syntax error occurred." + } + } + }, + "ExecutionResultMetadata": { + "type": "object", + "properties": { + "column_names": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Names of the columns in the result set." + }, + "result_set_bytes": { + "type": "integer", + "format": "int64", + "description": "Total number of bytes in the result set." + }, + "total_row_count": { + "type": "integer", + "description": "Total number of rows in the result set." + }, + "datapoint_count": { + "type": "integer", + "format": "int64", + "description": "The count of datapoints used for billing/pricing, based on the result set." + }, + "pending_time_millis": { + "type": "integer", + "description": "Time in milliseconds that the query was pending before execution." + }, + "execution_time_millis": { + "type": "integer", + "description": "Time in milliseconds that the query took to execute." + } + }, + "description": "Metadata about the execution of the query, including details like column names, row counts, and execution times." + }, + "ParameterObject": { + "type": "object", + "required": [ + "key" + ], + "properties": { + "key": { + "type": "string", + "description": "The key name of the parameter." + }, + "description": { + "type": "string", + "description": "A brief description of the parameter." + }, + "value": { + "type": "string", + "description": "The default value used by this parameter during execution, format depends on the type." + }, + "values": { + "type": "array", + "items": { + "type": "string" + }, + "description": "An array of string values, used when multiple selections are allowed." + }, + "type": { + "type": "string", + "enum": [ + "number", + "text", + "datetime", + "enum" + ], + "description": "The type of the parameter, determines the format of 'value(s)'. 'number': Numeric parameters, the value must be a number (e.g., '20'). 'text': String parameters, value can be any text including hex 0x-prefixed values (e.g., '0xae2fc...'), an empty value defaults to an empty string. 'datetime': Date and time parameters, value must be in 'YYYY-MM-DD hh:mm:ss' format (e.g., '2021-12-31 23:59:59'). 'enum': Parameters with a specific list of values, 'EnumValues' field is mandatory, providing a JSON list of strings representing valid options, the 'value' must be one of these options (e.g., 'Option1')." + }, + "EnumValues": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of valid options for 'enum' type parameters." + }, + "isMultiselect": { + "type": "boolean", + "description": "Indicates if multiple selections are allowed for this parameter." + }, + "isFreeformAllowed": { + "type": "boolean", + "description": "Indicates if freeform input is allowed for this parameter." + }, + "enumFromResults": { + "$ref": "#/components/schemas/EnumFromResults" + } + } + }, + "EnumFromResults": { + "type": "object", + "properties": { + "queryId": { + "type": "integer", + "description": "The ID of the query to fetch results from." + }, + "columnName": { + "type": "string", + "description": "The column name to use from the query results." + } + } + }, + "NotFoundError": { + "type": "object", + "required": [ + "error", + "message" + ], + "properties": { + "error": { + "type": "integer", + "format": "int32", + "description": "Error code for resource not found", + "example": 404 + }, + "message": { + "type": "string", + "description": "Error message for resource not found", + "example": "The requested resource was not found." + } + } + }, + "InternalServerError": { + "type": "object", + "properties": { + "error": { + "type": "integer", + "format": "int32", + "example": 500 + }, + "message": { + "type": "string", + "example": "internal error" + } + }, + "description": "Generic error message, given when an unexpected condition is encountered and no more specific message is available. Please consult the API documentation for more details." + } + } + } +} \ No newline at end of file diff --git a/api-reference/crud/archive.mdx b/api-reference/crud/archive.mdx new file mode 100644 index 00000000..20990092 --- /dev/null +++ b/api-reference/crud/archive.mdx @@ -0,0 +1,4 @@ +--- +title: 'Archive Query' +openapi: 'POST /v1/query/{queryId}/archive' +--- \ No newline at end of file diff --git a/api-reference/crud/create.mdx b/api-reference/crud/create.mdx new file mode 100644 index 00000000..6fcb90e9 --- /dev/null +++ b/api-reference/crud/create.mdx @@ -0,0 +1,4 @@ +--- +title: 'Create Query' +openapi: 'POST /v1/query' +--- \ No newline at end of file diff --git a/api-reference/crud/private.mdx b/api-reference/crud/private.mdx new file mode 100644 index 00000000..495be1f7 --- /dev/null +++ b/api-reference/crud/private.mdx @@ -0,0 +1,4 @@ +--- +title: 'Private Query' +openapi: 'POST /v1/query/{queryId}/private' +--- \ No newline at end of file diff --git a/api-reference/crud/read.mdx b/api-reference/crud/read.mdx new file mode 100644 index 00000000..6d63d99f --- /dev/null +++ b/api-reference/crud/read.mdx @@ -0,0 +1,4 @@ +--- +title: 'Create Query' +openapi: 'GET /v1/query/{queryId}' +--- \ No newline at end of file diff --git a/api-reference/crud/unarchive.mdx b/api-reference/crud/unarchive.mdx new file mode 100644 index 00000000..2bc84e15 --- /dev/null +++ b/api-reference/crud/unarchive.mdx @@ -0,0 +1,4 @@ +--- +title: 'Unarchive Query' +openapi: 'POST /v1/query/{queryId}/unarchive' +--- \ No newline at end of file diff --git a/api-reference/crud/unprivate.mdx b/api-reference/crud/unprivate.mdx new file mode 100644 index 00000000..495be1f7 --- /dev/null +++ b/api-reference/crud/unprivate.mdx @@ -0,0 +1,4 @@ +--- +title: 'Private Query' +openapi: 'POST /v1/query/{queryId}/private' +--- \ No newline at end of file diff --git a/api-reference/crud/update.mdx b/api-reference/crud/update.mdx new file mode 100644 index 00000000..b9f87d7f --- /dev/null +++ b/api-reference/crud/update.mdx @@ -0,0 +1,4 @@ +--- +title: 'Create Query' +openapi: 'POST /v1/query/{queryId}' +--- \ No newline at end of file diff --git a/api-reference/endpoint/create.mdx b/api-reference/endpoint/create.mdx deleted file mode 100644 index faa67581..00000000 --- a/api-reference/endpoint/create.mdx +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: 'Create Plant' -openapi: 'POST /plants' ---- - - - -```bash Request - curl --request POST \ - --url https://dog-api.kinduff.com/api/facts -``` - - \ No newline at end of file diff --git a/api-reference/endpoint/delete.mdx b/api-reference/endpoint/delete.mdx deleted file mode 100644 index 657dfc87..00000000 --- a/api-reference/endpoint/delete.mdx +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: 'Delete Plant' -openapi: 'DELETE /plants/{id}' ---- diff --git a/api-reference/endpoint/get.mdx b/api-reference/endpoint/get.mdx deleted file mode 100644 index 56aa09ec..00000000 --- a/api-reference/endpoint/get.mdx +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: 'Get Plants' -openapi: 'GET /plants' ---- From 3a56f0f5a74801b1c6a2368767c3cf3203b0aa41 Mon Sep 17 00:00:00 2001 From: Andrew <47720952+andrewhong5297@users.noreply.github.com> Date: Fri, 12 Jan 2024 16:07:19 -0500 Subject: [PATCH 2/8] move --- api-reference/{ => crud}/crud.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename api-reference/{ => crud}/crud.json (100%) diff --git a/api-reference/crud.json b/api-reference/crud/crud.json similarity index 100% rename from api-reference/crud.json rename to api-reference/crud/crud.json From d1ab5de5c9bf263f9d71e47f993411a47fe1735a Mon Sep 17 00:00:00 2001 From: Andrew <47720952+andrewhong5297@users.noreply.github.com> Date: Sun, 14 Jan 2024 17:26:59 -0500 Subject: [PATCH 3/8] move --- api-reference/crud/{ => endpoints}/archive.mdx | 0 api-reference/crud/{ => endpoints}/create.mdx | 0 api-reference/crud/{ => endpoints}/private.mdx | 0 api-reference/crud/{ => endpoints}/read.mdx | 0 api-reference/crud/{ => endpoints}/unarchive.mdx | 0 api-reference/crud/{ => endpoints}/unprivate.mdx | 0 api-reference/crud/{ => endpoints}/update.mdx | 0 7 files changed, 0 insertions(+), 0 deletions(-) rename api-reference/crud/{ => endpoints}/archive.mdx (100%) rename api-reference/crud/{ => endpoints}/create.mdx (100%) rename api-reference/crud/{ => endpoints}/private.mdx (100%) rename api-reference/crud/{ => endpoints}/read.mdx (100%) rename api-reference/crud/{ => endpoints}/unarchive.mdx (100%) rename api-reference/crud/{ => endpoints}/unprivate.mdx (100%) rename api-reference/crud/{ => endpoints}/update.mdx (100%) diff --git a/api-reference/crud/archive.mdx b/api-reference/crud/endpoints/archive.mdx similarity index 100% rename from api-reference/crud/archive.mdx rename to api-reference/crud/endpoints/archive.mdx diff --git a/api-reference/crud/create.mdx b/api-reference/crud/endpoints/create.mdx similarity index 100% rename from api-reference/crud/create.mdx rename to api-reference/crud/endpoints/create.mdx diff --git a/api-reference/crud/private.mdx b/api-reference/crud/endpoints/private.mdx similarity index 100% rename from api-reference/crud/private.mdx rename to api-reference/crud/endpoints/private.mdx diff --git a/api-reference/crud/read.mdx b/api-reference/crud/endpoints/read.mdx similarity index 100% rename from api-reference/crud/read.mdx rename to api-reference/crud/endpoints/read.mdx diff --git a/api-reference/crud/unarchive.mdx b/api-reference/crud/endpoints/unarchive.mdx similarity index 100% rename from api-reference/crud/unarchive.mdx rename to api-reference/crud/endpoints/unarchive.mdx diff --git a/api-reference/crud/unprivate.mdx b/api-reference/crud/endpoints/unprivate.mdx similarity index 100% rename from api-reference/crud/unprivate.mdx rename to api-reference/crud/endpoints/unprivate.mdx diff --git a/api-reference/crud/update.mdx b/api-reference/crud/endpoints/update.mdx similarity index 100% rename from api-reference/crud/update.mdx rename to api-reference/crud/endpoints/update.mdx From b42076f0a2076516f0c12783c375a1801f52d0cd Mon Sep 17 00:00:00 2001 From: Andrew <47720952+andrewhong5297@users.noreply.github.com> Date: Sun, 14 Jan 2024 18:18:28 -0500 Subject: [PATCH 4/8] add uploads --- .../crud/{crud.json => openapi.json} | 115 +---------- api-reference/upload/endpoints/upload.mdx | 4 + api-reference/upload/openapi.json | 187 ++++++++++++++++++ api-reference/upload/read_csv.py | 6 + 4 files changed, 201 insertions(+), 111 deletions(-) rename api-reference/crud/{crud.json => openapi.json} (91%) create mode 100644 api-reference/upload/endpoints/upload.mdx create mode 100644 api-reference/upload/openapi.json create mode 100644 api-reference/upload/read_csv.py diff --git a/api-reference/crud/crud.json b/api-reference/crud/openapi.json similarity index 91% rename from api-reference/crud/crud.json rename to api-reference/crud/openapi.json index 26bebb0c..25863d81 100644 --- a/api-reference/crud/crud.json +++ b/api-reference/crud/openapi.json @@ -277,7 +277,7 @@ "post": { "summary": "Archive a query on Dune", "description": "This API allows for anyone to archive a query. Only the API key generated under the context of the owner of that query will work. This does not delete the query, but will make it uneditable/unexecutable", - "operationId": "archive", + "operationId": "ArchiveQuery", "parameters": [ { "in": "header", @@ -364,7 +364,7 @@ "post": { "summary": "Unarchive a query on Dune", "description": "This API allows for anyone to unarchive a query. Only the API key generated under the context of the owner of that query will work.", - "operationId": "unarchive", + "operationId": "UnarchiveQuery", "parameters": [ { "in": "header", @@ -451,7 +451,7 @@ "post": { "summary": "Private a query on Dune", "description": "This API allows for anyone to private a query. Only the API key generated under the context of the owner of that query will work.", - "operationId": "private", + "operationId": "PrivateQuery", "parameters": [ { "in": "header", @@ -538,7 +538,7 @@ "post": { "summary": "Private a query on Dune", "description": "This API allows for anyone to unprivate a query. Only the API key generated under the context of the owner of that query will work.", - "operationId": "unprivate", + "operationId": "UnprivateQuery", "parameters": [ { "in": "header", @@ -876,113 +876,6 @@ ,"example": false } } - } - ,"QueryResult": { - "type": "object", - "required": [ - "executionId", - "queryId", - "state", - "submitted_at" - ], - "properties": { - "executionId": { - "type": "string", - "description": "Unique identifier for the execution of the query.", - "example": "01GXDTYMM2CKFRBEW44X5S0WZE" - }, - "queryId": { - "type": "integer", - "description": "Unique identifier of the query.", - "example": 1252207 - }, - "state": { - "type": "string", - "description": "The state of the query execution.", - "example": "QUERY_STATE_COMPLETED" - }, - "submitted_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp of when the query was submitted.", - "example": "2023-04-07T12:27:09.314513Z" - }, - "expires_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp of when the query result expires.", - "example": "2025-04-06T12:27:15.749155Z" - }, - "execution_started_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp of when the query execution started.", - "example": "2023-04-07T12:27:09.387366Z" - }, - "execution_ended_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp of when the query execution ended.", - "example": "2023-04-07T12:27:15.749154Z" - }, - "cancelled_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp of when the query execution was cancelled, if applicable.", - "example": "2023-04-08T12:27:15.749154Z" - }, - "result": { - "$ref": "#/components/schemas/QueryResultData" - }, - "error": { - "$ref": "#/components/schemas/QueryResultError" - } - } - }, - "QueryResultData": { - "type": "object", - "properties": { - "rows": { - "type": "array", - "items": { - "$ref": "#/components/schemas/QueryResultRow" - }, - "description": "The rows of data returned by the query." - }, - "metadata": { - "$ref": "#/components/schemas/ExecutionResultMetadata" - } - } - }, - "QueryResultError": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The type of error that occurred." - }, - "message": { - "type": "string", - "description": "A descriptive message about the error." - }, - "metadata": { - "$ref": "#/components/schemas/SyntaxErrorMetadata" - } - } - }, - "QueryResultRow": { - "type": "object", - "description": "A row is dictionary of key-value pairs, each pair corresponding to a column", - "example": [ - { - "TableName": "eth_blocks", - "ct": 6296 - }, - { - "TableName": "eth_traces", - "ct": 4474223 - } - ] }, "SyntaxErrorMetadata": { "type": "object", diff --git a/api-reference/upload/endpoints/upload.mdx b/api-reference/upload/endpoints/upload.mdx new file mode 100644 index 00000000..3e1b79c3 --- /dev/null +++ b/api-reference/upload/endpoints/upload.mdx @@ -0,0 +1,4 @@ +--- +title: 'Upload CSV' +openapi: 'POST /v1/query/{queryId}' +--- \ No newline at end of file diff --git a/api-reference/upload/openapi.json b/api-reference/upload/openapi.json new file mode 100644 index 00000000..edbcf3f2 --- /dev/null +++ b/api-reference/upload/openapi.json @@ -0,0 +1,187 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "OpenAPI for Upload API", + "description": "API for uploading CSVs to Dune", + "version": "1.0.0" + }, + "servers": [ + { + "url": "https://api.dune.com/api" + } + ], + "paths": { + "/v1/table/upload/csv": { + "post": { + "summary": "Upload a CSV as a table in Dune.", + "description": "This API allows for anyone to upload a CSV as a table in Dune. The size limit per upload is currently 200MB. Your storage is limited by plan, 1MB on free, 15GB on plus, and 50GB on premium.", + "operationId": "UploadCSV", + "parameters": [ + { + "in": "header", + "name": "X-DUNE-API-KEY", + "schema": { + "type": "string" + }, + "description": "API Key for accessing this service", + "required": true + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CSVUploadRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "query_id": { + "type": "integer", + "format": "int32", + "example": 1616880 + } + } + } + } + } + }, + "400": { + "description": "Bad Request - The request could not be understood by the server due to malformed syntax or validation failure.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "error": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string", + "example": "Core request validation failed" + } + } + } + } + } + }, + "404": { + "description": "Resource not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + }, + "500": { + "description": "Internal server error occurred. This usually happens due to unexpected issues in processing the request. It may include errors such as failure in core API execution, invalid query parameters, or issues with the customer data provided.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InternalServerError" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "CSVUploadRequest": { + "type": "object", + "properties": { + "Data": { + "type": "string", + "description": "The data to be uploaded in CSV format.", + "example": "DATE,DGS10, + 2023-12-01,4.22, + 2023-12-04,4.28, + 2023-12-05,4.18, + 2023-12-06,4.12, + 2023-12-07,4.14, + 2023-12-08,4.23, + 2023-12-11,4.23, + 2023-12-12,4.20, + 2023-12-13,4.04, + 2023-12-14,3.92, + 2023-12-15,3.91, + 2023-12-18,3.95, + 2023-12-19,3.93, + 2023-12-20,3.86, + 2023-12-21,3.89, + 2023-12-22,3.90, + 2023-12-25,., + 2023-12-26,3.89, + 2023-12-27,3.79, + 2023-12-28,3.84, + 2023-12-29,3.88" + }, + "Description": { + "type": "string", + "description": "Description of the upload.", + "example": "10 year daily interest rates, sourced from https://fred.stlouisfed.org/series/DGS10" + }, + "TableName": { + "type": "string", + "description": "The name of the table to store the data.", + "example": "ten_year_us_interest_rates" + }, + "IsPrivate": { + "type": "boolean", + "description": "Indicates if the upload is private.", + "example": false + } + } + }, + "NotFoundError": { + "type": "object", + "required": [ + "error", + "message" + ], + "properties": { + "error": { + "type": "integer", + "format": "int32", + "description": "Error code for resource not found", + "example": 404 + }, + "message": { + "type": "string", + "description": "Error message for resource not found", + "example": "The requested resource was not found." + } + } + }, + "InternalServerError": { + "type": "object", + "properties": { + "error": { + "type": "integer", + "format": "int32", + "example": 500 + }, + "message": { + "type": "string", + "example": "internal error" + } + }, + "description": "Generic error message, given when an unexpected condition is encountered and no more specific message is available. Please consult the API documentation for more details." + } + } + } +} \ No newline at end of file diff --git a/api-reference/upload/read_csv.py b/api-reference/upload/read_csv.py new file mode 100644 index 00000000..3f79b62f --- /dev/null +++ b/api-reference/upload/read_csv.py @@ -0,0 +1,6 @@ +file_name = r"c:\Users\13104\Downloads\DGS10.csv" + +with open(file_name) as open_file: + data = open_file.read() + +print(str(data)) \ No newline at end of file From d88a3756b553c80428e390f9e14491007ce7ed9d Mon Sep 17 00:00:00 2001 From: Andrew <47720952+andrewhong5297@users.noreply.github.com> Date: Tue, 16 Jan 2024 10:09:16 -0500 Subject: [PATCH 5/8] again --- api-reference/openapi.json | 195 ------------------------------ api-reference/upload/openapi.json | 23 +--- api-reference/upload/read_csv.py | 6 - 3 files changed, 1 insertion(+), 223 deletions(-) delete mode 100644 api-reference/openapi.json delete mode 100644 api-reference/upload/read_csv.py diff --git a/api-reference/openapi.json b/api-reference/openapi.json deleted file mode 100644 index b1509be0..00000000 --- a/api-reference/openapi.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "OpenAPI Plant Store", - "description": "A sample API that uses a plant store as an example to demonstrate features in the OpenAPI specification", - "license": { - "name": "MIT" - }, - "version": "1.0.0" - }, - "servers": [ - { - "url": "http://sandbox.mintlify.com" - } - ], - "security": [ - { - "bearerAuth": [] - } - ], - "paths": { - "/plants": { - "get": { - "description": "Returns all plants from the system that the user has access to", - "parameters": [ - { - "name": "limit", - "in": "query", - "description": "The maximum number of results to return", - "schema": { - "type": "integer", - "format": "int32" - } - } - ], - "responses": { - "200": { - "description": "Plant response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Plant" - } - } - } - } - }, - "400": { - "description": "Unexpected error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - }, - "post": { - "description": "Creates a new plant in the store", - "requestBody": { - "description": "Plant to add to the store", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/NewPlant" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "plant response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Plant" - } - } - } - }, - "400": { - "description": "unexpected error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - } - }, - "/plants/{id}": { - "delete": { - "description": "Deletes a single plant based on the ID supplied", - "parameters": [ - { - "name": "id", - "in": "path", - "description": "ID of plant to delete", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - } - ], - "responses": { - "204": { - "description": "Plant deleted", - "content": {} - }, - "400": { - "description": "unexpected error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Plant": { - "required": [ - "name" - ], - "type": "object", - "properties": { - "name": { - "description": "The name of the plant", - "type": "string" - }, - "tag": { - "description": "Tag to specify the type", - "type": "string" - } - } - }, - "NewPlant": { - "allOf": [ - { - "$ref": "#/components/schemas/Plant" - }, - { - "required": [ - "id" - ], - "type": "object", - "properties": { - "id": { - "description": "Identification number of the plant", - "type": "integer", - "format": "int64" - } - } - } - ] - }, - "Error": { - "required": [ - "error", - "message" - ], - "type": "object", - "properties": { - "error": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - } - }, - "securitySchemes": { - "bearerAuth": { - "type": "http", - "scheme": "bearer" - } - } - } -} \ No newline at end of file diff --git a/api-reference/upload/openapi.json b/api-reference/upload/openapi.json index edbcf3f2..4712bda8 100644 --- a/api-reference/upload/openapi.json +++ b/api-reference/upload/openapi.json @@ -107,28 +107,7 @@ "Data": { "type": "string", "description": "The data to be uploaded in CSV format.", - "example": "DATE,DGS10, - 2023-12-01,4.22, - 2023-12-04,4.28, - 2023-12-05,4.18, - 2023-12-06,4.12, - 2023-12-07,4.14, - 2023-12-08,4.23, - 2023-12-11,4.23, - 2023-12-12,4.20, - 2023-12-13,4.04, - 2023-12-14,3.92, - 2023-12-15,3.91, - 2023-12-18,3.95, - 2023-12-19,3.93, - 2023-12-20,3.86, - 2023-12-21,3.89, - 2023-12-22,3.90, - 2023-12-25,., - 2023-12-26,3.89, - 2023-12-27,3.79, - 2023-12-28,3.84, - 2023-12-29,3.88" + "example": "DATE,DGS10,\n2023-12-01,4.22,\n2023-12-04,4.28,\n2023-12-05,4.18,\n2023-12-06,4.12,\n2023-12-07,4.14,\n2023-12-08,4.23,\n2023-12-11,4.23,\n2023-12-12,4.20,\n2023-12-13,4.04,\n2023-12-14,3.92,\n2023-12-15,3.91,\n2023-12-18,3.95,\n2023-12-19,3.93,\n2023-12-20,3.86,\n2023-12-21,3.89,\n2023-12-22,3.90,\n2023-12-25,.,\n2023-12-26,3.89,\n2023-12-27,3.79,\n2023-12-28,3.84,\n2023-12-29,3.88" }, "Description": { "type": "string", diff --git a/api-reference/upload/read_csv.py b/api-reference/upload/read_csv.py deleted file mode 100644 index 3f79b62f..00000000 --- a/api-reference/upload/read_csv.py +++ /dev/null @@ -1,6 +0,0 @@ -file_name = r"c:\Users\13104\Downloads\DGS10.csv" - -with open(file_name) as open_file: - data = open_file.read() - -print(str(data)) \ No newline at end of file From 4d4c2c4928714ecc281805a921bcd72661185c7c Mon Sep 17 00:00:00 2001 From: Andrew <47720952+andrewhong5297@users.noreply.github.com> Date: Tue, 16 Jan 2024 10:14:45 -0500 Subject: [PATCH 6/8] upd --- api-reference/upload/openapi.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api-reference/upload/openapi.json b/api-reference/upload/openapi.json index 4712bda8..a94cc4b0 100644 --- a/api-reference/upload/openapi.json +++ b/api-reference/upload/openapi.json @@ -107,7 +107,7 @@ "Data": { "type": "string", "description": "The data to be uploaded in CSV format.", - "example": "DATE,DGS10,\n2023-12-01,4.22,\n2023-12-04,4.28,\n2023-12-05,4.18,\n2023-12-06,4.12,\n2023-12-07,4.14,\n2023-12-08,4.23,\n2023-12-11,4.23,\n2023-12-12,4.20,\n2023-12-13,4.04,\n2023-12-14,3.92,\n2023-12-15,3.91,\n2023-12-18,3.95,\n2023-12-19,3.93,\n2023-12-20,3.86,\n2023-12-21,3.89,\n2023-12-22,3.90,\n2023-12-25,.,\n2023-12-26,3.89,\n2023-12-27,3.79,\n2023-12-28,3.84,\n2023-12-29,3.88" + "example": "DATE,DGS10,\n2023-12-04,4.28,\n2023-12-05,4.18,\n2023-12-06,4.12,\n2023-12-07,4.14,\n2023-12-08,4.23,\n2023-12-11,4.23" }, "Description": { "type": "string", From aa005d0c8864a4b3fb9ddf95a78ed8d8cd2e0fa7 Mon Sep 17 00:00:00 2001 From: Andrew <47720952+andrewhong5297@users.noreply.github.com> Date: Tue, 16 Jan 2024 10:20:28 -0500 Subject: [PATCH 7/8] remove opid --- api-reference/upload/openapi.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/api-reference/upload/openapi.json b/api-reference/upload/openapi.json index a94cc4b0..aadd2fb8 100644 --- a/api-reference/upload/openapi.json +++ b/api-reference/upload/openapi.json @@ -13,9 +13,7 @@ "paths": { "/v1/table/upload/csv": { "post": { - "summary": "Upload a CSV as a table in Dune.", "description": "This API allows for anyone to upload a CSV as a table in Dune. The size limit per upload is currently 200MB. Your storage is limited by plan, 1MB on free, 15GB on plus, and 50GB on premium.", - "operationId": "UploadCSV", "parameters": [ { "in": "header", From 25c4cb7f71e7631e902818f1d1fb3a4fa32b9213 Mon Sep 17 00:00:00 2001 From: Andrew <47720952+andrewhong5297@users.noreply.github.com> Date: Tue, 16 Jan 2024 10:26:40 -0500 Subject: [PATCH 8/8] renamed endpoint --- api-reference/crud/{endpoints => endpoint}/archive.mdx | 0 api-reference/crud/{endpoints => endpoint}/create.mdx | 0 api-reference/crud/{endpoints => endpoint}/private.mdx | 0 api-reference/crud/{endpoints => endpoint}/read.mdx | 0 api-reference/crud/{endpoints => endpoint}/unarchive.mdx | 0 api-reference/crud/{endpoints => endpoint}/unprivate.mdx | 0 api-reference/crud/{endpoints => endpoint}/update.mdx | 0 api-reference/upload/{endpoints => endpoint}/upload.mdx | 0 api-reference/upload/openapi.json | 2 ++ 9 files changed, 2 insertions(+) rename api-reference/crud/{endpoints => endpoint}/archive.mdx (100%) rename api-reference/crud/{endpoints => endpoint}/create.mdx (100%) rename api-reference/crud/{endpoints => endpoint}/private.mdx (100%) rename api-reference/crud/{endpoints => endpoint}/read.mdx (100%) rename api-reference/crud/{endpoints => endpoint}/unarchive.mdx (100%) rename api-reference/crud/{endpoints => endpoint}/unprivate.mdx (100%) rename api-reference/crud/{endpoints => endpoint}/update.mdx (100%) rename api-reference/upload/{endpoints => endpoint}/upload.mdx (100%) diff --git a/api-reference/crud/endpoints/archive.mdx b/api-reference/crud/endpoint/archive.mdx similarity index 100% rename from api-reference/crud/endpoints/archive.mdx rename to api-reference/crud/endpoint/archive.mdx diff --git a/api-reference/crud/endpoints/create.mdx b/api-reference/crud/endpoint/create.mdx similarity index 100% rename from api-reference/crud/endpoints/create.mdx rename to api-reference/crud/endpoint/create.mdx diff --git a/api-reference/crud/endpoints/private.mdx b/api-reference/crud/endpoint/private.mdx similarity index 100% rename from api-reference/crud/endpoints/private.mdx rename to api-reference/crud/endpoint/private.mdx diff --git a/api-reference/crud/endpoints/read.mdx b/api-reference/crud/endpoint/read.mdx similarity index 100% rename from api-reference/crud/endpoints/read.mdx rename to api-reference/crud/endpoint/read.mdx diff --git a/api-reference/crud/endpoints/unarchive.mdx b/api-reference/crud/endpoint/unarchive.mdx similarity index 100% rename from api-reference/crud/endpoints/unarchive.mdx rename to api-reference/crud/endpoint/unarchive.mdx diff --git a/api-reference/crud/endpoints/unprivate.mdx b/api-reference/crud/endpoint/unprivate.mdx similarity index 100% rename from api-reference/crud/endpoints/unprivate.mdx rename to api-reference/crud/endpoint/unprivate.mdx diff --git a/api-reference/crud/endpoints/update.mdx b/api-reference/crud/endpoint/update.mdx similarity index 100% rename from api-reference/crud/endpoints/update.mdx rename to api-reference/crud/endpoint/update.mdx diff --git a/api-reference/upload/endpoints/upload.mdx b/api-reference/upload/endpoint/upload.mdx similarity index 100% rename from api-reference/upload/endpoints/upload.mdx rename to api-reference/upload/endpoint/upload.mdx diff --git a/api-reference/upload/openapi.json b/api-reference/upload/openapi.json index aadd2fb8..a94cc4b0 100644 --- a/api-reference/upload/openapi.json +++ b/api-reference/upload/openapi.json @@ -13,7 +13,9 @@ "paths": { "/v1/table/upload/csv": { "post": { + "summary": "Upload a CSV as a table in Dune.", "description": "This API allows for anyone to upload a CSV as a table in Dune. The size limit per upload is currently 200MB. Your storage is limited by plan, 1MB on free, 15GB on plus, and 50GB on premium.", + "operationId": "UploadCSV", "parameters": [ { "in": "header",