Example code curl command error

I ran into some trouble following Example code 3 and 4 , when I tried to send
curl -L 'http://api.notefile.net/req?product={app:00000000-0000-0000-0000-00000000000}&device={imei:000000000000000}' -d '{"req":"note.add","file":"my-inbound.qi", "body": {"my-request-type":"my-request"}}'

In the command prompt window it returns

curl: (3) URL using bad/illegal format or missing URL
'device' is not recognized as an internal or external command,
operable program or batch file.

When I try to implement via Run Curl Commands Online, I get the following error
{"err":"please sign-in and then provide an authentication token to process this request"}

Help would be greatly appreciated.

Hey @LBBD, see this for syntax help on doing a note.add via curl. You’ll want to swap in the Product UID instead of app and DeviceUID instead of the device imei.

In terms of getting an auth token, see here for info on generating a token for your use.

Thanks for the prompt reply.
I must be missing something fundamental. This is the login attempt:

C:\Users\user>curl -X POST -L 'https://api.notefile.net/auth/login' -d '{"username":"userr@url.com", "password": "pw25963KDDR"}' -v
Note: Unnecessary use of -X or --request, POST is already inferred.
* Closing connection -1
curl: (3) URL using bad/illegal format or missing URL
Note: Unnecessary use of -X or --request, POST is already inferred.
* Closing connection -1
curl: (3) URL using bad/illegal format or missing URL
curl: (3) unmatched close brace/bracket in URL position 16:
pw25963KDDR}'
               ^
>curl -V
curl 7.79.1 (Windows) libcurl/7.79.1 Schannel
Release-Date: 2021-09-22
Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp
Features: AsynchDNS HSTS IPv6 Kerberos Largefile NTLM SPNEGO SSL SSPI UnixSockets

On Windows, the ’ isn’t recognized for quotes, and the " in the JSON needs to be escaped

curl -X POST -L "https://api.notefile.net/auth/login" -d "{\"username\":\"xxxxxxxxxxxxxx\", \"password\": \"xxxxxxxxxxxxx\"}" -v

Another option is to use Windows Subsystem Linux (WSL), which then you can use the cURL examples as is without needing to escape the "

Thank you @gwolff , this syntax definitely took the process one step further. Unfortunately deciphering the response is beyond the scope of my knowledge, so I’d appreciate further guidance.

Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 34.199.196.208:443...
* Connected to api.notefile.net (34.199.196.208) port 443 (#0)
* schannel: disabled automatic use of client certificate
* schannel: ALPN, offering http/1.1
* schannel: ALPN, server accepted to use http/1.1
> POST /auth/login HTTP/1.1
> Host: api.notefile.net
> User-Agent: curl/7.79.1
> Accept: */*
> Content-Length: 65
> Content-Type: application/x-www-form-urlencoded
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 400 Bad Request
< Date: Mon, 28 Mar 2022 22:59:39 GMT
< Content-Type: application/json; charset=utf-8
< Content-Length: 0
< Connection: keep-alive
< Vary: Origin
<
* Connection #0 to host api.notefile.net left intact

Hey @LBBD the “Bad Request” response could indicate that your password is incorrect, so I would double-check that. Another possibility: did you create your Notehub account by linking it to GitHub? If so, you’ll need to explicitly set a password in your account settings in Notehub and use that for the token request.

This may be very well the culprit but either I’m doing something wrong or there is bug playing games.
Originally I did sign up with GitHub indeed, but after reading the Notehub API introduction I managed to create a password in the account setting which I used for the curl login.
Nevertheless, if I log out of the account and try to log back in with that password, it doesn’t work.
What am I doing wrong?

Hi Gabor,

There may be a bug at play here. We’ve seen a couple cases if the Notehub account is associated with a Github account, then the HTTP request for the token doesn’t work at all.

I’m not exactly sure what state your account is currently in.

If you are able to sign into the account, please follow the steps below.

If you are not able to sign in to your account, please let me know via a direct message, or by reaching out to Blues Support by clicking the “Support” button at the top of the Notehub page.

Workaround for Token Request Failures due to active Github Authentication for Notehub Account

  1. Disable the Github integration, and configure it to use username and password to login.

  2. Issue the cURL request to get the Notehub access token (I strongly urge you not to display the token on the forum)

  3. Confirm you are able to issue Notehub HTTP requests via cURL with the token

  4. Re-enable your Notehub account to log in via Github.

How to disable Github account authorization

  1. Sign into your Notehub account

  2. Click the “down arrow” to the right of your Notehub account name in the upper-right of the Notehub page and select “Account Settings”

image

  1. Click the “Unlink Github” button under the “Social Sign in” section

image

  1. To re-enable, follow steps 1-3 again, but this time the button will now show “Link Github”
    image
1 Like

Hi Gabor,

I reproduced this issue with a similar Github-linked account. We are looking into this issue and will deliver a fix in the near future.

Were you able to unlink your account successfully?

Jim

Hi Jim, unfortunately not.
I pm-ed Greg as well on this.
The Unlink button has no effect. It doesn’t change to “Link GitHub” and if I log out I cannot log back with the password. I can, however with my GitHub account.
As I read your message, I gave it another try and the behavior is even more weird.
As I clicked on the Unlink button, it took me to
[Notehub | Confirm Access](https://notehub.io/sign-in?flow=03edf79d-fdf9-48ff-b0f4-0f7f55e78a6b)
Showing this:
noteHubPw_9
Something is up with this pesky unlink.

Hi Gabor,
We’ve isolated a bug that impacted both setting a local password and unlinking from Github. We will have a fix for everyone coming out by early next week.
However, to get you going, I’ve updated your account so that setting a local password should now work. Once you’ve done that, you should be able to acquire a session token in the documented way.
Apologies for the bug and the delay in getting it fixed. Please let us know how you make out.
Jim