Sending JSON-LD markup with mailgun doesn't work - mailgun

I'm trying to send email via SMTP with Mailgun. The email has an application/ld+json markups EventReservation. If I send the email with mailgun smtp, the markups does not work, if I send the same template via google.scripts, the markups works fine.
What is the problem?
This is my template:
<!DOCTYPE html>
<html>
<head>
<title>Prenotazine TiPrenota</title>
<meta charset="UTF-8">
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "EventReservation",
"reservationNumber": "5aa46b79-140d-491e-a1db-568ec1c423bd",
"reservationStatus": "http://schema.org/Confirmed",
"underName": {
"#type": "Person",
"name": "Mario Rossi
},
"reservationFor": {
"#type": "Event",
"name": "Ragione sociale attivita",
"startDate": "2017-03-27T12:30:00",
"location": {
"#type": "Place",
"name": "nome ragione sociale",
"address": {
"#type": "PostalAddress",
"streetAddress": "viale amore 100, cesena, 47521, Italia"
},
"geo": {
"#type": "GeoCoordinates",
"latitude": "44,490501",
"longitude": "12,281881"
}
},
"performer":"Reservation"
},
"modifyReservationUrl": "https://www.domionio.it/?tokenid=5aa46b79-140d-491e-a1db-568ec1c423bd"
}
</script>
</head>
<body>
Testo emeil
</body>
</html>

Make sure that you have followed this steps on how to send an email using SMTP.
Run this:
# Swaks is an smtp of CURL, install it first:
curl http://www.jetmore.org/john/code/swaks/files/swaks-20130209.0/swaks -o swaks
# Set the permissions for the script so you can run it
chmod +x swaks
# It's based on perl, so install perl
sudo apt-get -y install perl
# now send!
./swaks --auth \
--server smtp.mailgun.org \
--au postmaster#YOUR_DOMAIN_NAME \
--ap 3kh9umujora5 \
--to bar#example.com \
--h-Subject: "Hello" \
--body 'Testing some Mailgun awesomness!'
You can find your SMTP credentials for each domain on your domains tab.

Related

Create issue API for jira giving 404 from postman

I am trying to call jira rest API from postman for creating a issue
Follwing is my curl from postman
url --location --request POST 'https ://mydomain.com/jira/rest/api/2/issue' \
--header 'Authorization: Basic XXXXXXXX' \
--header 'Accept: application/json' \
--data-raw '{
"fields": {
"project": {
"id": "12019"
},
"issuetype": {
"id": "10002"
},
"customfield_12404" : {
"id": "12444"
},
"customfield_12394" : {
"id": "12421"
},
"summary": "Test of rest API",
"customfield_12391" : 1,
"customfield_11143": "test"
}
}'
I am getting bad request in response
<body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
I am not sure what is wrong in this. I tried searching on this but did not get proper solution for my issue Can anyone help me on this ?
Thanks

Sentry cannot find my source code

I cannot display my original code in sentry dashboard.
i get the following errors
Discarded invalid parameter 'type'
Source code was not found for app:///crna-entry.delta?
platform=ios&dev=true&minify=false`
I've configured the app.json as indicated in the docs.
"hooks": {
"postPublish": [
{
"file": "sentry-expo/upload-sourcemaps",
"config": {
"organization": "xxxxx",
"project": "xxxxxxx",
"authToken": "xxxxxxxxxx"
}
}
]
}
I answered this question here
First way
If you are using expo. You should use sentry-expo package which you can find here: sentry-expo
Put this hook to your expo json (app.json) file
{
"expo": {
"hooks": {
"postPublish": [
{
"file": "sentry-expo/upload-sourcemaps",
"config": {
"organization": "<your organization name>",
"project": "<your project name>",
"authToken": "<your auth token here>"
}
}
]
}
}
organization you can find on here https://sentry.io/settings/ which named "Organization Name"
project enter your project name, you can find here: https://sentry.io/organizations/ORGANIZATION_NAME/projects/
authToken create a authToken with this url https://sentry.io/api/
Then run expo publish, it upload the source maps automatically.
Testing Locally
Make sure that you enabled expo development.
add lines;
Sentry.enableInExpoDevelopment = true;
Sentry.config(publicDsn, options).install();
As a Result
On sentry, for only ios, you can able to see the source code where error occured.
BUT: unable to see the source code for ANDROID
https://github.com/getsentry/react-native-sentry/issues/372
Second way (manual upload)
Using the api https://docs.sentry.io/platforms/javascript/sourcemaps/
curl -X POST \
https://sentry.io/api/0/organizations/ORG_NAME/releases/VERSION/files/ \
-H 'Authorization: Bearer AUTH_TOKEN' \
-H 'content-type: multipart/form-data' \
-F file=#script.min.js.map \
-F 'name=~/scripts/script.min.js.map'

Searching in ElasticSearch using Get Request

I am trying to search for documents in ElasticSearch .
I want to pass the query string as JSON . I am unable to do that.
How can I do that?
I want to pass this JSON request body in my search request.
{"query": {
"bool": {
"must": [
{ "match": { "last_name": "Doe" }}
]
}
}}
In order to send a request, you would need to define the header as application/json and send a POST/GET request to _search endpoint. Below is a sample CURL request for reference which can be run in the terminal.
curl -X POST -H "Content-Type: application/json" -d '{"query": {"bool": { "must": [{ "match": { "last_name":"Doe" }}]}}}' "http://localhost:9200/index_name/_search"
Link for reference: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html
Hope it helps.

Keystone v3 auth error

I am following keystone ocata installation guide https://docs.openstack.org/ocata/install-guide-ubuntu/keystone-install.html
Post installation, I am able to get the user list using openstack user list command.
openstack --os-auth-url="[keystone_url]" --os-identity-api-version="3" --os-password="mypwd123" --os-project-domain-name="Default" --os-project-name="admin" --os-username="admin" --os-user-domain-name="Default" user list
Outputs the User list properly.
But when I take auth token with below command :
curl -si -d '{"auth": {"identity": {"methods": ["password" ],"password": {"user": {"domain": {"id": "default" },"name": "admin","password": "mypwd123" }}}}}' -H "Content-type: application/json" [keystone_url]/v3/auth/tokens
and then use the token from the output of above command in below command to list the users:
curl -s -H "X-Auth-Token: gAAAAABZlAN0NPibgBLcUW3aAcgNYIGaRH98M7w6b4tRliXC4LQB4dr5cGxTJmF5-iKvY2U_AU3c71uJUqgaQJP-iyURCBzBqYHlHtTGqofzzVndVncBRU5z4iLbArBdbJCI2Wd-1No9C0cq4iWB6RBNa9wqXWm-Gw" "[keystone_url]/v3/users" | python -mjson.tool
Returns :
{
"error": {
"code": 403,
"message": "You are not authorized to perform the requested action: identity:list_users.",
"title": "Forbidden"
}
}
Any help would be appreciated.
Thanks,
Viral
because list users need token with scopeļ¼Œ you should add scope for query, like this:
curl -i http://ip:5000/v3/auth/tokens -H "Content-
Type: application/json" -d '
{
"auth": {
"identity": {
"methods": [
"password"
],
"password": {
"user": {
"name": "admin",
"domain": {
"name": "Default"
},
"password": "secret"
}
}
},
"scope": {
"domain": {
"id": "default"
}
}
}
}'
then use X-Subject-Token to query users.
See the official documentation for details.https://docs.openstack.org/keystone/pike/api_curl_examples.html#tokens

Postman: Newman collection runner unable to send form url-encoded parameters in body with calls

In postman to send credentials to setup login in the body section x-www-form-ulrencoded. This works absolutely fine.
After exporting this script in newman collection runner, this does not work.
Following is the output:
-------------------------------------------------------------------------------------------
401 3361ms Login Call [POST] https://<url>/login
------------------------------------------------------------
Request headers:
{
"content-type": "application/x-www-form-urlencoded",
"host": "<url>",
"accept-encoding": "gzip, deflate",
"content-length": 0
}
Request data:
{
"userid": "user",
"password": "pswd"
}
------------------------------------------------------------
Response headers:
{
"x-frame-options": "SAMEORIGIN",
"content-type": "application/json",
"x-content-type-options": "nosniff",
"date": "...",
"cache-control": "no-cache",
"content-length": "120",
"x-xss-protection": "1; mode=block",
"connection": "close",
"accept-ranges": "bytes"
}
Response body:
{"errorCode":"401","errorMessage":"Login failed, please check the credentials","errorDescription":"API Request Failure"}
Also, when i generate curl code from postman i don't see the user/pswd headers attached:
curl -X POST \
https://<url>/login \
-H 'cache-control: no-cache' \
-H 'content-type: application/x-www-form-urlencoded' \
-H 'postman-token: 5b04e538-498c-9e43-2be9-8523073260f9'
Using Postman Chrome app:
Postman for Chrome
Version 5.0.2
win / x86-64
Chrome 59.0.3071.115
So the issue over here is the version of Newman installed.
So I got the latest version:
//to install
npm install -g newman
//needed to use Newman.run instead of Newman.execute
newman run c:\s -e c:\env --reporters cli,json --reporter-json-export c:\out.json -k
//-k was required to bypass ssl security issues.