terminusdb / terminusdb-bootstrap

TerminusDB Bootstrap
https://terminusdb.com/
Apache License 2.0
66 stars 12 forks source link

API request error #21

Closed Amrosx closed 3 years ago

Amrosx commented 3 years ago

I am running terminusdb-bootstrap docker image and calling api using postman

POST https://localhost:6363/api/db/<organization>/<dbid> Body

{ < "prefixes" : { < "doc" : Document_Prefix >,
                   < "scm" : Schema_Prefix > } >
  "label" : "A Label",
  "comment" : "A Comment",
  < "public" : Boolean >,
  < "schema" : Boolean >
}

I got this error what does it mean and how can I solve it

{
    "code": 500,
    "message": "Stream <stream>(0x556761c9cc00):1:3 Syntax error: json(illegal_json)"
}
spl commented 3 years ago

Hi @Amrosx.

Sorry for the confusion! The angle brackets (< and >) are not meant to be used literally in the request described in the API docs. Rather, they should indicate something that can optionally be included. That is, if the documentation says:

{ "a": "b",
  < "c": "d" >
}

then, you could write, for example, {"a": "b"} or {"a": "b", "c": "d"}. Either way, you still have to provide valid JSON syntax, which has requirements like double quotes around strings and commas between name-value pairs.

Also, when you see something like Document_Prefix, that means you should provide the actual prefix, and where you see Boolean, you would write true or false.

Finally, we're currently working on a major new release as well as shining new light on our documentation. We'll be sure to keep questions like yours in mind while we're developing.

Hope that helps!

Amrosx commented 3 years ago

Hi @spl thanks for replying. I tried to use it as JSON then I got autherzation error and I am not using any password for admin/foo what is the permission? and if possible could you write me a correct syntax api request example (creating user or db) because all my tries failed unfortunatly.

POST https://localhost:6363/api/db/admin/foo

{  "prefixes" : {  "doc" : "<terminusdb:///data/>" ,
                    "scm" : "<terminusdb:///schema#>"  } ,
  "label" : "A Label",
  "comment" : "A Comment",
   "public" : true ,
   "schema" : false
}

response
{
    "action": "system:create_database",
    "api:message": "Access to doc:admin_organization is not authorised with action system:create_database and auth doc:anonymous",
    "api:status": "api:forbidden",
    "auth": "doc:anonymous",
    "scope": "doc:admin_organization"
}
Amrosx commented 3 years ago

thanks for me this issue has been solved I was missing the basic auth username : admin password : root

Acutally in documentation there are missing a clear step by step for biginers and some terms are confusing like what is Organization, Agent, authentication ...

spl commented 3 years ago

@Amrosx I'm glad you figured out your issue. And I agree, there are some issues with the docs. We're working on it!