Github API: Mulitple parameters not Working - api

ENVIRONMENT: Ubuntu 20.04
TASK: Mine all closed bug reports (issues) with the label 'incorrect' from the repository Ansible.
SOLUTIONS: I have tried using Github's REST API via the curl command. However, curl is either stalling or simply producing a server error. I have not seen much usage of how to include multiple parameters or working with large requests even from the documentation
First thing I tried was to mine just the closed issues, below mines all the closed issues or so it seems. It looks like it only includes a couple which leads me to think there are 'pages' to large requests?
curl "https://api.github.com/repos/ansible/ansible/issues?state=closed" > closed_issues
However the 'labels' is not working for me neither is combining the two. I get a "server_error" and it stops there.
curl "https://api.github.com/repos/ansible/ansible/issues?state=closed&labels=incorrect" > labeled_closed_issues

Related

Why am I getting different responses on the same Curl request?

I have two vps, when I do curl --verbose https://es.aliexpress.com/item/1005004830406404.html
different things happen, on a server it returns the response correctly with the following header
https://hastebin.com/onifayedam.yaml
but on the other server, newly configured it returns 404 with the following header
https://hastebin.com/okibilihir.php-template
I have tried to reinstall the certificates, even to reinstall the operating system from 0 without any result.
I would be grateful for any help or recommendation.

Using curl or other similar request tool to find all suffix to a URL link

The question maybe rudimentary but I'm not familiar with how it could be done efficiently. I am trying to understand how a docker image works which would expose a variety of endpoints as follow:
http://localhost:8080/predictions/{something}
or
http://localhost:8080/metrics/{something}
What is the command or tool that I could use to obtain all the possible option for that {something} that returns a healthy request?

Microsoft Graph - PHP Rest Example: cURL error 60: SSL certificate

I'm actually trying to get this simple example to work, so I can have a working example of Microsoft Graph APIs.
PHP (Rest based code sample) >> https://developer.microsoft.com/en-us/graph/quick-start
After saving the files, adding dependencies using Composer and running WampServer. I get through the starting page, sign-in Microsoft Account, give access/permission and then when the page returns back to localserver , I get these 'cURL' errors.
I've searched over the web and here on stackoverflow which all suggests me to try to download cacert.pem file and add it to php.ini as (curl.cainfo="[path]\cacert.pem") but it doesn't work with me.
If any of you have tried this sample, then kindly do update me on how to get over this. If I can disable this check, then also how?

cURL API Commands

I have a question about API's and cURL. I'm not sure if this is all Python, but I am trying to access JSON data using an API, but the server isn't as easy as grabbing the data with an XMLRequest... The support team gave me this line of code:
curl -k -s --data "api_id=xxxx&api_key=xxxx&time_range=today&site_id=xxxxx"
https://my.incapsula.com/api/stats/v1
And I have no idea what this even means because all the API requests I've been making was just as easy as using a link and parsing through it with some JavaScript. Can anyone break the -k -s --data for me or point me in a right tutorial?
(NOT PYTHON; Sorry guys...)
The right tutorial is the man page.
-k/--insecure
(SSL) This option explicitly allows curl to perform "insecure" SSL connections and transfers. All SSL connections are attempted to be made secure by using the CA certificate bundle installed by default. This makes all connections considered "insecure" fail unless -k/--insecure is used.
See this online resource for further details: http://curl.haxx.se/docs/sslcerts.html
-s/--silent
Silent or quiet mode. Don't show progress meter or error messages. Makes Curl mute.
As for --data, well, it specify the data you are sending to the server.
This question is (for now) not related to Python at all, but eventually to shell scripting.

CouchDB replication is not working properly behind a proxy

Note: Made some updates based on new information. Old ideas have been added as comments below.
Note: Made some updates (again) based on new information. Old ideas have been added as comments below (again).
We are running two instances of CouchDB on separate computers behind Apache reverse proxies. When attempting to replicate between the two instances:
curl -X POST http://user:pass#localhost/couchdb/_replicate -d '{ "source": "db1", "target": "http://user:pass#10.1.100.59/couchdb/db1" }' --header "Content-Type: application/json"
(we started using curl to debug the problem)
we receive an error similar to:
{"error":"case_clause","reason":"{error,\n {{bad_return_value,\n {invalid_json,\n <<\"<!DOCTYPE HTML PUBLIC \\\"-//IETF//DTD HTML 2.0//EN\\\">\\n<html><head>\\n<title>404 Not Found</title>\\n</head><body>\\n<h1>Not Found</h1>\\n<p>The requested URL /couchdb/db1/_local/01e935dcd2193b87af34c9b449ae2e20 was not found on this server.</p>\\n<hr>\\n<address>Apache/2.2.3 (Red Hat) Server at 10.1.100.59 Port 80</address>\\n</body></html>\\n\">>}},\n {child,undefined,\"01e935dcd2193b87af34c9b449ae2e20\",\n {gen_server,start_link,\n [couch_rep,\n [\"01e935dcd2193b87af34c9b449ae2e20\",\n {[{<<\"source\">>,<<\"db1\">>},\n {<<\"target\">>,\n <<\"http://user:pass#10.1.100.59/couchdb/db1\">>}]},\n {user_ctx,<<\"user\">>,\n [<<\"_admin\">>],\n <<\"{couch_httpd_auth, default_authentication_handler}\">>}],\n []]},\n temporary,1,worker,\n [couch_rep]}}}"}
So after further research it appears that apache returns this error without attempting to access CouchDB (according to the log files). To be clear when fed the following URL
/couchdb/db1/_local/01e935dcd2193b87af34c9b449ae2e20
Apache passes the request to CouchDB and returns CouchDB's 404 error. On the other hand when replication occurs the URL actually being passed is
/couchdb/db1/_local%2F01e935dcd2193b87af34c9b449ae2e20
which apache determines is a missing document and returns its own 404 error for without ever passing the request to CouchDB. This at least gives me some new leads but I could still use help if anyone has an answer offhand.
The source CouchDB (localhost) is telling you that the remote URL was invalid. Instead of a CouchDB response, the source is receiving the Apache httpd proxy's file-not-found response.
Unfortunately, you may have some reverse-proxy troubleshooting to do. My first guess is the Host header the source is sending to the target. Perhaps it's different from when you connect directly from a third location?
Finally, I think you probably know this, but the path
/couchdb/db1/_local%2F01e935dcd2193b87af34c9b449ae2e20
Is not a standard CouchDB path. By the time CouchDB sees a request, it should have the /couchdb stripped, so the query is for a document called _local%2f... in the database called db1.
Incidentally, it is very important not to let the proxy modify the paths before they hit couch. In particular, if you send %2f then CouchDB had better receive %2f and if you send / then CouchDB had better receive /.
From official documentation...
Note that HTTPS proxies are in theory supported but do not work in 1.0.1. This is because 1.0.1 ships with ibrowse version 1.5.5. The CouchDB version in trunk (from where 1.1 will be based) ships with ibrowse version 1.6.2. This later ibrowse contains fixes for HTTPS proxies.
Can you see which version of ibrowse is involved? Maybe update that ver?
Another thought I have is with regard to the SSL certs. If you don't have any, and I know you don't :), then technically you're doing SSL wrong. In java we know there are ways around this, but maybe try putting in proper certs since all SSL stuff basically involves certs.
And for my last contribution (today) I would say have you looked through this document which seems highly relevant?
http://wiki.apache.org/couchdb/Apache_As_a_Reverse_Proxy