Legacy Firebase conditions not working with curl - firebase-cloud-messaging

This call:
curl -X POST \
-H "Authorization: key=AAAAx4uYEXU:...e8EEq9aCv-pGWXIfyCp_lUp28mY" \
-H "Content-Type: application/json" \
-d '{ "data": {
"score": "5x1",
"time": "15:10"
},
"condition": "'dogs' in topics || 'cats' in topics",
"content_available": true
}' \
"https://fcm.googleapis.com/fcm/send"
Causes this error:
Invalid "condition" field: only support 'topics' conditions
I copied the condition field straight from the documentation... how can I get this to work?

Related

Propagate a return to the WMS with Shippingbo

My company uses Shippingbo as an OMS and WMS
I try to create a return order from the OMS to the WMS
The return order is rightly created in my OMS but not in my WMS and I have to trigger the propagation in the UI and I would like to do it automaticaly
The request I made:
curl --request POST \
--url https://app.shippingbo.com/returns_orders \
--header 'X-API-USER: my_user' \
--header 'X-API-TOKEN: passwd' \
--header 'X-API-VERSION: 1' \
--header 'Content-Type: application/json' \
--data '{
"source": "Prestashop-staging",
"source_ref": "XMLPJGHU",
"reason": "Bad size",
"reason_ref": "S/M",
"return_order_type": "return_order_customer",
"return_order_expected_items_attributes": [
{
"quantity": 1,
"user_ref": "shirt-and-flag"
}
]
}'
You must add an additional parameter that is the supplier_id
curl --request POST \
--url https://app.shippingbo.com/returns_orders \
--header 'X-API-USER: my_user' \
--header 'X-API-TOKEN: passwd' \
--header 'X-API-VERSION: 1' \
--header 'Content-Type: application/json' \
--data '{
"source": "Prestashop-staging",
"source_ref": "XMLPJGHU",
"reason": "Bad size",
"reason_ref": "S/M",
"return_order_type": "return_order_customer",
"supplier_id": __your_id__,
"return_order_expected_items_attributes": [
{
"quantity": 1,
"user_ref": "shirt-and-flag"
}
]
}'
To get the supplier_id you can request:
curl --request GET \
--url https://app.shippingbo.com/suppliers/available_for_return_order \
--header 'Content-Type: application/json'
Don't forget to add your credentials in the header

Authorization error in Onfido with same api token

I am using onfido v3.2 and I want to create SDK token. First I had create applicant using sandbox API key.
curl -X POST https://api.eu.onfido.com/v3.2/applicants/ \
-H 'Authorization: Token token=<YOUR_API_TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"first_name": "Jane",
"last_name": "Doe"
}'
Then I had use applicant id from above api response for create SDK token and use same API token. https://documentation.onfido.com/#create-applicant
curl -X POST https://api.eu.onfido.com/v3.2/sdk_token \
-H 'Authorization: Token token=<YOUR_API_TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"applicant_id": "<APPLICANT_ID>"
}'
I am using same API TOKEN in both api but sdk create api return error.
https://documentation.onfido.com/#generate-sdk-token
{
"error": {
"type": "authorization_error",
"message": "Authorization error: please re-check your credentials",
"fields": {}
}
}
I don't understand what going wrong here? Thank you in advance.

add role to a user in a client keycloak

i want to add role to user in specific client keycloak by api in postman but i get "error": "Client not found"
this url:
POST-
http://localhost:8080/auth/admin/realms/{realmName}/users/{userId}/role-mappings/clients/{clientId}
this Body:
{
"roles": [
{
"id": "0830ff39-43ea-48bb-af8f-696bc420c1ce",
"name": "confirm-kilid-user",
"description": "${role_uma_authorization}",
"composite": false,
"clientRole": true,
"containerId": "344e7c81-e7a2-4a43-b013-57d7ed198eee"
}
]
}
This curl works. We should give clientId ("a48108f0-8465-4f91-8a90-39c72f1a05b8") as containerId and roleId ("36c11a6e-a43a-427c-9c28-90352b369d79") as Id.
curl -X POST \
http://localhost:7600/auth/admin/realms/adanic/users/4cf43901-663a-4796-bca7-fdfb8642476d/role-mappings/clients/a48108f0-8465-4f91-8a90-39c72f1a05b8 \
-H 'Accept: */*' \
-H 'Accept-Encoding: gzip, deflate' \
-H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJtNnlDZ1ZsbVZRbW5QSmo2UC14Vm1rdG84dnVKNVdhSnlqNTR6d1llSHk0In0.eyJqdGkiOiJjY2U3YTVjNy03YTRmLTQ2ODktYTM2Zi03YjkyOTJhNjlkY2EiLCJleHAiOjE1Nzc1OTg4NDgsIm5iZiI6MCwiaWF0IjoxNTc3NTEyNDQ4LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0Ojc2MDAvYXV0aC9yZWFsbXMvbWFzdGVyIiwic3ViIjoiYzJmOGQwYTctZDYyOC00OWEwLWFhZTUtNzdiMDBkMzRkNjQ4IiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiYWRtaW4tY2xpIiwiYXV0aF90aW1lIjowLCJzZXNzaW9uX3N0YXRlIjoiN2Q4OThhZjAtN2FkMS00YzVkLTgwNmQtOWQwMTNlNDEwMjY0IiwiYWNyIjoiMSIsInNjb3BlIjoicHJvZmlsZSBlbWFpbCBwaG9uZSIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwicHJlZmVycmVkX3VzZXJuYW1lIjoiYWRtaW4ifQ.IZ9mx-05mNU2UOvKDXjLbiSbbpoVV7sTKeXAzY7bLbduYApDA9vRsOkUCLB_2Hhdj53Fjp_DxoMKkRsc-D4GIbTTBpKEmB65cH8xsKlt-Ne9vMLW5n_SZRaptTysUHPSfh-NxlUSFwAjXyYp2cH1TQBmUVW3czF1b_8i8b3KAIheq7VLyZcQ8mUTTli1egHlUNLOoqmQO3BEU-fcaI4SPfMHZ4pDWYfFHUJ3B1-be1MTCaVT3LVZKpi7spb-H_o3zmRJnLQdxDqG0-BAIBsytaq6vQ1gf4wzQAzbTvT5VB8FnyRkWID8vum4MW_3XfjABPS2_j1F2cs7Grh7xYd2ew' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Content-Length: 285' \
-H 'Content-Type: application/json' \
-H 'Host: localhost:7600' \
-H 'User-Agent: PostmanRuntime/7.20.1' \
-H 'cache-control: no-cache' \
-d ' [
{
"id": "36c11a6e-a43a-427c-9c28-90352b369d79",
"name": "test",
"description": "${role_create-client}",
"composite": false,
"clientRole": true,
"containerId": "a48108f0-8465-4f91-8a90-39c72f1a05b8"
}
]

Get latest tag commit from bitbucket api 2.0

I am trying to create a utility tool for which I need to get the latest tag committed to a specific repo.
I have tried so far:
curl -X GET \
https://api.bitbucket.org/2.0/repositories/<team>/<reposlug>/refs/tags \
-H 'Accept: */*' \
-H 'Accept-Encoding: gzip, deflate' \
-H 'Authorization: Basic encodedpasswd' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Host: api.bitbucket.org'
What I get in return is paginated response, like this:
{
"pagelen": 10,
"values": [
{
"name": "release-1.2",
"links": {
},
"tagger": {
},
"date": "2019-11-15T11:53:56+00:00",
"message": "[maven-release-plugin]copy for tag release-1.2\n",
"type": "tag",
"target": {
}
},
{
"name": "release-1.3",
"links": {
},
"tagger": {
},
"date": "2019-11-20T07:53:51+00:00",
"message": "[maven-release-plugin]copy for tag release-1.3\n",
"type": "tag",
"target": {
}
}
],
"page": 1
}
Now as per the documentation I have referred through here, tags are specially ordered when returned, but I am confused as to why the value release-1.3 is not first in the response. I think I am missing something. Or if this is the expected order, how can I achieve the tags sorted on date attribute, to get the latest tag.
So I was able to solve this by using sort on attribute target.date.
curl -X GET \
https://api.bitbucket.org/2.0/repositories/<team>/<reposlug>/refs/tags?sort=target.date \
-H 'Accept: */*' \
-H 'Accept-Encoding: gzip, deflate' \
-H 'Authorization: Basic encodedpasswd' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Host: api.bitbucket.org'

Creating a tag with the Bitbucket Server API fails

I'm trying to use the Bitbucket Server RST API to create a new tag for a specific commit (represented by a hash). Please note that I use basic auth but don't write it to my examples below. What I've got is an HTTP 500 response.
curl -XPOST 'http://<server>/rest/api/latest/projects/p1/repos/r1/tags' -d '{
   "name": "my-new-tag",
    "hash": "0d2019c8e18f8c961cdb67cb27afb69b04f3a10b"
}'
I also tried:
curl -XPOST 'http://<server>/2.0/repositories/username/r1/refs/tags' -d '{
   "name": "my-new-tag",
    "hash": "0d2019c8e18f8c961cdb67cb27afb69b04f3a10b"
}'
But in this case the request ends up in an HTTP 404 and I think that's because this is not a Bitbucket Server URL.
You can try this way:
curl -X POST -k -H 'Content-Type: application/json' -s -u <Your Account>:<Your password> -i 'https://api.bitbucket.org/2.0/repositories/username/r1/refs/tags' --data '{
"name": "my-new-tag",
"target":{
"hash": "0d2019c8e18f8c961cdb67cb27afb69b04f3a10b"
}
}'
or
curl -X POST -k -H 'Content-Type: application/json' Authorization: Basic <<Authentication String>>' -i 'https://api.bitbucket.org/2.0/repositories/username/r1/refs/tags' --data '{
"name": "my-new-tag",
"target":{
"hash": "0d2019c8e18f8c961cdb67cb27afb69b04f3a10b"
}
}'