apache - Creating an index with REST API -


i'm trying create index within set under specific namespace, unsure how it.

my resources have http example:

post /example/v1/index/{namespace}/{set}/{indexname} 

and example input:

 {  "fields": [      { "indexfield": "firstname", "indexreverseorder": true },      { "indexfield": "lastname" }  ],  "options": {      "isunique": true  } } 

this consumes

application/json;charset=utf-8 

but when write out

curl -x post exampleurl.com/example/v1/index/example_namespace/example_set/example set -d " {  "fields": [      { "indexfield": "firstname", "indexreverseorder": true },      { "indexfield": "lastname" }  ],  "options": {      "isunique": true  } }" -h "content-type : application/json;charset=utf-8" 

i following http status code

http/1.1 415 unsupported media type 

can explain me what's going on , how might fix this? also, let me know if don't have enough information api understand it, thanks!

edit:

as sort of reference, api when create set in namespace do:

curl -x post http://exampleurl.com/example/v1/store/example_namespace -d "example_set" -h "content-type: application/json;charset=utf-8"  

and successful. thought indexes similar this, apparently not.

the error due bash shell misinterpreting double quotes before json

curl -x post exampleurl.com/example/v1/index/example_namespace/example_set/example set -d " {  "fields": [      { "indexfield": "firstname", "indexreverseorder": true },      { "indexfield": "lastname" }  ],  "options": {  "isunique": true  } }" -h "content-type : application/json;charset=utf-8" 

should be:

curl -x post exampleurl.com/example/v1/index/example_namespace/example_set/example set -d ' {  "fields": [      { "indexfield": "firstname", "indexreverseorder": true },      { "indexfield": "lastname" }  ],  "options": {  "isunique": true  } }' -h "content-type : application/json;charset=utf-8" 

the difference single quotes encapsulating json. bash shell give error in trying execute command.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -