I would like to send a message and I call api.
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"caller":"maituanmte%40localhost","to":"admin%40localhost","body": "Hi all"}' 'http://localhost:8088/api/messages'
the status=204 and body response no content. But when I get message by
curl -X GET --header 'Accept: application/json' 'http://localhost:8088/api/messages/admin%40localhost'
then status = 200 and body=[] (no messages). I have exchange admin and maituanmte but the same result.
Please help me. Thanks
Messages will be returned from the server only if mod_mam is enabled. Could you confirm you have this module enabled and configured?
I recommend using MongooseIM from master branch [1] as the MAM configuration was significantly simplified recently [2], [3]
[1]. https://github.com/esl/MongooseIM
[2]. https://github.com/esl/MongooseIM/blob/master/doc/modules/mod_mam.md
[3]. http://mongooseim.readthedocs.io/en/latest/modules/mod_mam/
Related
Good afternoon, everyone! Guys I'm going through a problem with basic authentication in Postman, I'll leave below details of what's going on. I need to send a Post so I can perform authentication and the server will return me a token bearer, but I'm taking a 400 error. I'll leave attached images of the Curl request and how I'm setting up in Postman.
Auth:
enter image description here
Body:
enter image description here
Reading the documentation I'm using I realized that I needed to perform a basic authentication using client_id and client_secret for me to be returned a token bearer, the same error is returned to me when I perform a request in curl. Could you help me with this mistake? Could you tell me where I'm going wrong?
Segue requisição curl:
curl -X 'POST' \
'https://portoapicloud-hml.portoseguro.com.br/oauth/v2/access-token' \
-H 'accept: application/json' \
-H 'Authorization: Basic NjZiNWJmMWI4MDE0NDExMWE1MGYwMWMyYmUxZjFiZDY6YzIwMGEwNzZlNmFkNDBkYThkYTkwODQ2YWI4OTI3MjU=' \
-H 'Content-Type: application/json' \
-d '{
"grant_type": "client_credentials"
}'
I am sending a request like below:
curl --request GET \
--url 'https://api.pagerduty.com/services?query=my-service-name' \
--header 'Accept: application/vnd.pagerduty+json;version=2' \
--header 'Authorization: Token token=y_NbAkKc66ryYTWUXYEu' \
--header 'Content-Type: application/json'
I was expecting that i can use this to filter the list of services JSON to my service only using query=my-service-name. But this just returns a JSON list of first 25 services. API Guide says:
query(string) - Filters the result, showing only the tags whose labels match the query.
Is there any way to get the details of service just with the service name? Currently i can add a huge limit to the query which will essentially bring all service names and i can get my service from that but that is hardly efficient.
I know i can do GET with service ID, Like below:
curl --request GET \
--url https://api.pagerduty.com/services/SVC_ID \
--header 'Accept: application/vnd.pagerduty+json;version=2' \
--header 'Authorization: Token token=y_NbAkKc66ryYTWUXYEu' \
--header 'Content-Type: application/json'
but my requirement is to use the service name.
Your question lines up on the time-frame of when PagerDuty broke the query filter for services. Your query looks accurate from my experience.
See:
https://community.pagerduty.com/forum/t/query-filter-is-not-working/3853
Also, while the description of the API says "filters on tags" you'll find it filters on the name of the service first.
How can I get all the data from the bounced emails using API call.
When I use my API call to get data, I only retrieve first 500 records using curl, Can it be possible to get all the data and download in a file.
The command which I am using is as below ... I tried to increase limit of the API call with 501 below was the error ? Can any one let me know how to resolve ?
curl --request GET \
--url https://${API_CALL} \
--header 'accept: application/json' \
--header 'authorization: Bearer ${AUTH_TOKEN}' \
curl --request GET \
--url https://${API_CALL}?limit=501 \
--header 'accept: application/json' \
--header 'authorization: Bearer ${AUTH_TOKEN}' \
{"errors":[{"field":"limit","message":"must be between 0 and 500"}]}
I am trying to do a simple script to change firewall rules on my VM hosting. I used the google API explorer, and the script generated is as follows
curl --request PUT \ 'https://www.googleapis.com/compute/v1/projects/learnstoresg/global/firewalls/intranet2?requestId=00000000-0000-0000-0000-000000000033' \
--header 'Authorization: Bearer [YOUR_BEARER_TOKEN]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"allowed":[{"IPProtocol":"TCP","ports":["4033","4016"]}],"sourceRanges":["101.127.7.227"]}' \
--compressed
Anyone has an example of php script for google firewall or can help me convert this CURL statement into a php script?
I need some help because i never receive push event in my serviceworker after payload encryption.
First case without payload encrypted
In this case, I receive push event in service worker:
Request is :
curl -s --header "Authorization: key=MY_KEY" --header "Content-Type: application/json" --header "TTL:86400" https://android.googleapis.com/gcm/send -d "{\"registration_ids\":[\"elmll0-ynBY:APA91bFe7xBGti92H4yrWo2bJT6aMY3IKo3j54yRGtS0NNQYpkqmI5f14EKSPz6_GCEs2PaX6zCD3Lvk-2JRABQVZ3u350bsy0uisxRL0EoZnVHsqVMo7YNojkvQX7o49a61pCmZEfSi\"],\"delay_while_idle\":false,\"collapse_key\":\"hipush-notification\",\"time_to_live\":86400}"
Google response is :
{"multicast_id":5772871775830750210,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1465913797471899%f4d428f3bf364ddd"}]}
Second test, with encrypted raw_data
I never receive push event:
- Request is :
curl -s --header "Authorization: key=MY_KEY" --header "Content-Type: application/json" --header "TTL:86400" --header "Encryption: salt=KYw1fpU-Dg4w1qFcrPY3rQ" --header "Crypto-Key: dh=BOwb4OiwboYRrbhhXh056xFZ8pk8kfQR27Gmu3EdYPG9DkLoKRqA_d4Z_TbT2VYMfHVkGS-dY45rZ8tAimqSWrk" --header "Content-Encoding:aesgcm" https://android.googleapis.com/gcm/send --header "Content-Length: 363" -d "{\"registration_ids\":[\"elmll0-ynBY:APA91bFe7xBGti92H4yrWo2bJT6aMY3IKo3j54yRGtS0NNQYpkqmI5f14EKSPz6_GCEs2PaX6zCD3Lvk-2JRABQVZ3u350bsy0uisxRL0EoZnVHsqVMo7YNojkvQX7o49a61pCmZEfSi\"],\"delay_while_idle\":false,\"collapse_key\":\"hipush-notification\",\"time_to_live\":86400,\"raw_data\":\"rXJHqmhxmTde+297wtb3Tpj5Lq5C8cd2eYW5qTBoC3huGVTOPog6+I2Y6wQEYqP1QIAvUA0NFtYC7Zr\/iCR1sGcu\"}"
Google response is :
{"multicast_id":7840093467258640262,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1465913901129815%f4d428f3bf364ddd"}]}
I got same response with success. My chrome is in version 51.
Can someone explain me where is my error ?
Best regards,
Mehdi
Which language are you using? You could use one of the libraries here https://github.com/web-push-libs (Node.js, PHP, Python, Java currently supported), which have already fixed the problem for you.