Launcher API and curl

Hello. Has anybody used REST API from linux commandline with curl?
With Launcher v0.10.0 on Linux I’m running a command like this:

curl -v --data "$APP_DATA_JSON" --header "Content-Type: application/json" http://localhost:8100/auth

And get error 404 in response:

{"errorCode":404,"description":"Endpoint Not Found"}

… just like the /auth endpoint was a wrong address. Am I missing something?

I just tried that and it works for me. What’s the value in $APP_DATA_JSON?

I copied it from API documentation:

"{ app: { name: \"Sample Application\", id: \"com.maidsafe.sample\", version: \"0.0.1\", vendor: \"MaidSafe\" }, permissions: [ \"SAFE_DRIVE_ACCESS\" ]}"

Can you copy the output of your command, please? Maybe It will explain something.

The problem seems to be the quotes, this should work:
export APP_DATA_JSON='{ "app": { "name": "Sample Application", "id": "com.maidsafe.sample", "version": "0.0.1", "vendor": "MaidSafe" }, "permissions": [ "SAFE_DRIVE_ACCESS" ]}'

3 Likes

That worked. Thank you :slight_smile: My laziness was the problem. Indeed, when creating objects in JavaScript, quotes on property names can be omitted, but JSON standard requires them.

Anyway, the error message could be more connected to the issue.

3 Likes