Eclipse Hono - 404 Error while creating a Tenant - eclipse-hono

I am using the command as shown in the below documentation to create a Tenant in Hono.
https://www.eclipse.org/hono/docs/api/management/#/tenants/createTenantWithId
curl -X POST "http://srvgal89.deri.ie:28080/v1/tenants/DEFAULT_TENANT_11" -H "accept: application/json" -H "Content-Type: application/json"
<html><body><h1>Resource not found</h1></body></html>
As per the documentation : All operations, except the tenants resource are required. The tenant management might be outside of the scope of the device registry and managed by a higher level system. In this case all calls should simply return 404.
I am assuming this might be the reason for getting Resource not found. But I am not sure what do you mean by outside the scope of device registry.
Please let me know if I am missing something.

I guess you'll need to omit the accept header.

Related

Self-Hosted Gitlab Invalid reCaptcha key type

I am self hosting Gitlab, and added force reCaptcha to login/register.
I accidentally entered a v3 key and not a v2 key and now I can't log in because it shows:
ERROR for site owner: Invalid key type.
Any idea on how to change it manually in the files?
I am running Ubuntu Desktop 18.04.4
I did the same mistake and was mistaken ReCaptcha v2 with v3. I was completely locked out and didn't have the personal access token.
This solution worked for me as well. However, I would not recommend doing it so, if you are not familiar with Postgres or even GitLab's configuration, you don't know if other auditing actions are intercepting once you updated the configuration in the admin panel and you might break something else.
This solution is just updating GitLab's application setting via gitlabhq_production database. The following steps work in my case having the Omnibus package installation method used. I assume it should not be much different if you have direct access to the database.
gitlab-psql -d gitlabhq_production # login to GitLab's database
UPDATE application_settings SET login_recaptcha_protection_enabled = 'f'; # to disable login with recaptcha check
gitlab-ctl reconfigure # to reconfigure Gitlab instance or restart your Gitlab instance.
If you can connect to the GItLab server, you could, as noted in gitlab-org/gitlab-foss issue 46548
disable reCAPTCHA in the admin settings (admin/application_settings/reporting)
Once disable, you can at least log on, and re-enable the feature, this time entering a v2 key.
Another possibility, which I used:
If you're able to gain access via a previously generated (and saved) GitLab ReST API - PERSONAL ACCESS TOKEN (created with All Scopes / Full Admin privileges), then you can use that token to update your reCAPTCHA keys via the following CLI command:
user$ curl --request PUT --header \
"PRIVATE-TOKEN: <PersonalAccessToken>" \
"https://gitlab.example.com/api/v4/application/settings?recaptcha_private_key=<SecretKey>&recaptcha_site_key=<SiteKey>"
I hope this helps others.

Authentication required error while using curl command

I am trying to use curl command , but I keep on getting Authentication required error time and again.The part of reponse is shown below :-
"Authentication Required" response (307)
I am working on a network which is behind a proxy server. So have tried to provide the proxy authentication during the request too. But have not been successfull.
Please suggest a solution.
if the URL you are trying to access is behind a login wall, you need to supply the HTTP Header "Authorization".
for example, if the server accepts basic authorization:
header=Authorization, value="Basic user:password".
replace user and password with your account credentials.
see related answer: Setting authorization using CURL
Good Luck!

Sending a request in curl via a proxy with a basic auth

How do I send a request in curl via proxy which requires basic authentication? I've skimmed through the documentation of curl and found the options -p and --proxy-basic but how exactly I could use them I couldn't figure out.
Note I don't want to apply the proxy setting system wide, I only want to send a particular request via proxy.
Found the anwser myself after some more digging:
http://curl.haxx.se/docs/manual.html states
NOTE! According to the URL specification, HTTP URLs can not contain a user and password, so that style will not work when using curl via a proxy, even though curl allows it at other times. When using a proxy, you must use the -u style for user and password.
So I was doing it the wrong way :)
Answer:
https://unix.stackexchange.com/questions/119410/using-curl-to-access-basic-auth-protected-website-via-proxy-polipo

Calling SOAP webservice using curl

I need to call a SOAP webservice using curl..
The service needs a username(user1) but does not need a password..When I execute the below, its asking for password and when I click ENTER it throws an "404" error. The same request passes successfully on SOAPUI tool.
curl -v -H "Content-Type: application/octet-stream; charset=utf-8" \
-H "SOAPAction:" \
-d #soap.csv \
-X POST https://s.net/sotest/FileAttachmentService?wsdl \
-u user1
curl's -u parameter specifies the user/password for HTTP authentication.
All HTTP authentication schemes have a userid and a password, of some kind.
Your claim that you only need to provide a username suggests that username is really a parameter of your SOAP call, rather than used for HTTP authentication.
Another potential problem I can see is that SOAP is really just XML over HTTP, and most SOAP services typically use either text/xml or application/xml MIME content type, rather than application/octet-stream.
So, talk to whoever runs your SOAP service. Find out whether you are expected to use HTTP authentication or include a username parameter in your SOAP request, as well as the MIME type of your SOAP request.
I dont think that the problem is related to the user/pass as you'd get a 403 (permision denied) and not a 404 (not found) in case there is something wrong with the authentication information. It must be related to the URL. Are you sure that the complete URL is correct? You should take the "?wsdl" out of the URL-path, because this points to the location of the WSDL and not to the Webservice endpoint.

using curl with authentication

I am running a local node.js server. I need to make a POST request with curl. It this request a user should be authenticated. So I specify user name and password in the request. The problem is that I get an error that the token cannot be found, even though login credentials are correct (I can login to the remote server directly).
curl --user username:mypassword -X POST -d '["some data"]' "http://0.0.0.0:3000/problems/problemId"
The server responses:
can not find match token bXNoYXZsb4Z1
What can be the problem? Do I use curl correctly?
There is not enough details about the server side in your question but the problem could come from the encoding of the POST data.
From the man page of curl :
-d, --data is the same as --data-ascii. To post data purely binary, you should instead use the --data-binary option. To URL-encode the value of a form field you may use --data-urlencode.
So you should try these different options.
The -X option could also be removed. From the man page :
Normally you don't need this option. All sorts of GET, HEAD, POST and PUT requests are rather invoked by using dedicated command line options.

Resources