API in URL doesn't work but it does in Terminal - api

I have the following API:
curl "https://api.prospect.silktide.com/api/v1/report/145b2bec22e731280103639ef580e5f4eb809942" --header "api-key: f92022fc208a3b83fe2aa85d239560f7f0a55823"
It works perfectly fine in terminal, however when I put it on my web browser as:
https://api.prospect.silktide.com/api/v1/report/145b2bec22e731280103639ef580e5f4eb809942" --header "api-key: f92022fc208a3b83fe2aa85d239560f7f0a55823"
It doesn't give any data the same way as terminal, any idea why?

Related

Calling an API using CURL with a path throws Directory name is invalid

I have a curl command that works when I go on to the server to run it to call the api from command prompt which looks like this.
C:\curl\bin\curl --header Content-Length:0 --location --request POST "http://localhost:15022/api/process"
but I have to set it up to run every few mins so I have cronJob function that runs it, for which I need to define a path and it looks like
{
"cronInterval": "*/15 * * * *",
"path": "C:\curl\bin\curl --header Content-Length:0 --location --request POST 'http://localhost:15022/api/process'"
}
When I do the above and when the job tries to run the curl and call the api, it throws the error
"System.ComponentModel.Win32Exception (267): The directory name is invalid
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)".
I am really not sure what it is I am missing here in the path to curl. Curl exists in that path and it works when I run manually using command prompt. Any help is appreciated.

Trello Rest API - Adding an existing label to an existing card with curl

I’ve tried everything to get this to work via curl. I do believe the documentation is incorrect as the example shows no id field for adding a label(url to doc below). I would think the add and delete commands should work the same way.
This works fine:
curl --request DELETE --url “https://api.trello.com/1/cards/629e3e010ae1e7152f3d971e/idLabels/5c92632a91d0c2ddc590b2a0?key=mykey&token=mytoken” --header “Accept: application/json”
I would think the similar syntax for adding a label should work, but it doesn’t
curl --request POST --url “https://api.trello.com/1/cards/629e3e010ae1e7152f3d971e/idLabels/5c92632a91d0c2ddc590b2a0?key=mykey&token=mytoken” --header “Accept: application/json”
The returned message is “Can not POST”.
Thanks for the help.
FYI:
https://developer.atlassian.com/cloud/trello/rest/api-group-cards/?_ga=2.242290244.712236952.1654529435-2033339426.1654016513#api-cards-id-idlabels-post

Dockerhub API. How to escape '/' in curl command

I am trying to retrieve information about images on Dockerhub. For that I am using this curl command:
curl -X GET https://hub.docker.com/v2/repositories/library/<image-name>/tags/<image-tag>
With most images this works totally fine. However, when using an image that has a '/' in its name it does not work anymore. Is there a way I can somehow escape the '/' in the curl command? I already tried '\' but this did not work for my case.
Example for reproducing:
curl -X GET https://hub.docker.com/v2/repositories/library/curlimages/curl/tags/7.81.0

Curl is not hitting url specified

Currently I am on curl version : curl 7.60.0 (x86_64-pc-linux-gnu).
I updated the verision and hitting the following url:
curl -v http://www.google.com
It fails to get response for a linux box.
At the same time if I hit it from windows, with the version curl 7.60.0 (i386-pc-win32), It fetched response.
I would like to know if there is any version instability.

Google FCM - can not subscribe to topic - returns 502 or "error INTERNAL"

Trying to subscribe device token to a topic on server. According to FCM server docs proceeding the request:
curl --header "Authorization: key=AAAA...qC1GXg" \
--header "Content-Type:application/json" \
-X POST -d '{}' \
"https://iid.googleapis.com/iid/v1/BY7kK...rbZ/rel/topics/mytopic"
which returns :
502. The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds
The same 502 is returned when I'm trying to get token info with "details" parameter, like this:
curl --header "Authorization: key=AAAA...C1GXg" \
"https://iid.googleapis.com/iid/info/BY7kK...rbZ?details=true"
While if not adding "details" parameter, it all ok - it returns 200 and json data:
{"applicationVersion":"24","attestStatus":"UNKNOWN","application":"com.my.app","scope":"*","authorizedEntity":"...","appSigner":"...","platform":"ANDROID"}
I have also tried a batchAdd:
curl --header "Authorization: key=AAAA...81GXg" \
--header "Content-Type:application/json" \
-X POST \
-d '{"to":"/topics/mytopic", "registration_tokens": ["BY7k...rbZ"]}' \
"https://iid.googleapis.com/iid/v1:batchAdd"
and it ends up with :
{"results":[{"error":"INTERNAL"}]}
Authorization key and device token I use should be OK, since I can get token data (without topics), and sending messages to that device (also using curl) works OK.
Still, this 502 is happening for more than 24h for me so far.
That's a new FCM project - I'm not migrating from GCM or anything. Android app is live on market for some time, but I haven't used cloud messaging there before.
Any ideas with what could be wrong here? Thank you.
Found the cause. In case if someone will make the same mistake:
My Android app is published under one Google account, while I have created a project in Firebase console under a different account.
Having the app and Firebase project under same Google account - and all works like a charm.
Meanwhile, Google maps API keys, which also are used in my Android app, were generated under that second account, and everything is OK.