Closed StevenJSun closed 5 years ago
Hi @StevenJSun,
probably you have to add the Content-Type:text/csv
header in the request :
try:
http -a deployop:deployop1234 POST http://10.60.224.45:8888/csv Content-Type:text/csv db=="bddas" coll=="test" < C:\Users\Administrator\Desktop\test.csv -v
Hi @StevenJSun, probably you have to add the
Content-Type:text/csv
header in the request :try:
http -a deployop:deployop1234 POST http://10.60.224.45:8888/csv Content-Type:text/csv db=="bddas" coll=="test" < C:\Users\Administrator\Desktop\test.csv -v
@22Viig thanks , it works, but I use another rest client to execute it, it still returns 400 bad request. and I want to know how to use programming language to request the service to upload csv files, for example java or python.
Ok perfect. Probably you have to add the Content-Type in your rest client. You can use any HTTP Client Rest Library you want written in any language with RESTHeart of course, I personally use http://unirest.io/ , its a library available in many languages like java and python.
Expected Behavior
execute httpie command: upload csv files should return 200 response
Current Behavior
execute httpie command:upload csv files return 400 bad request.
Context
Environment
Operating System: CentOS 7.0 RESTHeart version: 4.0.0 MongoDB version: 4.0.6
Relevant files:
1、restheart.yml
instance-name: {{{instance-name}}}
https-listener: {{{https-listener}}} https-host: {{{https-host}}} https-port: {{{https-port}}}
http-listener: {{{http-listener}}} http-host: {{{http-host}}} http-port: {{{http-port}}}
ajp-listener: {{{ajp-listener}}} ajp-host: {{{ajp-host}}} ajp-port: {{{ajp-port}}}
mongo-uri: {{{mongo-uri}}}
mongo-mounts:
default-representation-format: {{{default-representation-format}}}
plugins-args: logMessageInitializer: enabled: true message: Hello World! log-level: INFO addBodyToWriteResponsesInitializer: enabled: true pingService:
uri: "\hello"
use-embedded-keystore: true
aggregation-check-operators: true
allow-unescaped-characters-in-url: true
etag-check-policy: db: REQUIRED_FOR_DELETE coll: REQUIRED_FOR_DELETE doc: OPTIONAL
enable-log-file: true log-file-path: /qhapp/logs/restheart.log enable-log-console: true log-level: {{{log-level}}} ansi-console: true requests-log-level: 1 metrics-gathering-level: DATABASE requests-log-trace-headers:
default-pagesize: 100
max-pagesize: 1000
cursor-batch-size: 1000
local-cache-enabled: true
local-cache-ttl: 60000
schema-cache-enabled: true
schema-cache-ttl: 60000
requests-limit: 1000
query-time-limit: {{{query-time-limit}}}
aggregation-time-limit: {{{aggregation-time-limit}}}
eager-cursor-allocation-pool-size: 100
eager-cursor-allocation-linear-slice-width: 1000 eager-cursor-allocation-linear-slice-delta: 100 eager-cursor-allocation-linear-slice-heights: [4, 2, 1] eager-cursor-allocation-random-max-cursors: 20 eager-cursor-allocation-random-slice-min-width: 1000
force-gzip-encoding: true
io-threads: {{{io-threads}}}
worker-threads: {{{worker-threads}}}
buffer-size: 16384 buffers-per-region: 20
direct-buffers: true
MAX_HEADER_SIZE: 1048576
MAX_ENTITY_SIZE: -1
MULTIPART_MAX_ENTITY_SIZE: -1
IDLE_TIMEOUT: -1
REQUEST_PARSE_TIMEOUT: -1
NO_REQUEST_TIMEOUT: -1
MAX_PARAMETERS: 1000
MAX_HEADERS: 200
MAX_COOKIES: 200
URL_CHARSET: UTF-8
ALWAYS_SET_KEEP_ALIVE: true
ALWAYS_SET_DATE: true
2、default.properties:
https-listener = false https-host = localhost https-port = 4443
http-listener = true http-host = 0.0.0.0 http-port = 8888
ajp-listener = true ajp-host = 0.0.0.0 ajp-port = 8009
instance-name = default
default-representation-format = STANDARD
mongo-uri=mongodb://deployop:deployop1234@10.60.233.249:24000
root-mongo-resource='*'
log-level = DEBUG
query-time-limit = 0 aggregation-time-limit = 0
io-threads: 4 worker-threads: 16
Steps to Reproduce
http -a deployop:deployop1234 POST http://10.60.224.45:8888/csv db=="bddas" coll=="test" < C:\Users\Administrator\Desktop\test.csv -v
MongoDB Account: deployop:deployop1234
Possible Implementation