Google sRich Snippets. Redirect from https://schema.org to http://schema.org - google-rich-snippets

I tried to add data to google rich spinner to my application. I add this code structure
return {
'#context': 'https://schema.org',
'#type': 'Product',
'sku': this.currentProduct.sku,
'category': this.productCategory,
'name': this.productName,
'description': this.productDescription,
'offers': {
'#type': 'Offer',
'price': this.bestPrice,
'priceCurrency': 'USD',
'availability': this.currentProduct.stock?.is_in_stock ? 'https://schema.org/InStock' : 'https://schema.org/OutOfStock'
},
'image': this.thumbnail
}
But if I look to result on search.google.com/test/rich-results I will see that the availability field has been assigned a https://schema.org/InStock value (not https). why is this happening? Is it important for the project?

It's not an issue. Schema.org are transitioning to use https, but for a long time it was http, and http will with for a long time to come.

Related

Running multiple apps in a server hiding ports

Im developing two different chatbots and I have them on a Google Platform VM. I want to know how to access to them like this:
-> https://example.com/chatbot1
-> https://example.com/chatbot2
Instead of having:
-> https://example.com:5001
-> https://example.com:5002
I want to do that so I can run multiple chatbots on the same VM and I dont expose the ports. After doing this the idea is to insert the chatbot on a 3rd user web like this:
<script>
WebChat.default.init({
selector: "#webchat",
initPayload: "XXX",
interval: 1000,
customData: {"userId": "123"},
socketUrl: "http://example.com/chatbot1",
socketPath: "/socket.io/",
title: "XXX",
subtitle: "XXX",
inputTextFieldHint: "XXX",
connectingText: "XXX",
hideWhenNotConnected: true,
fullScreenMode: false,
showFullScreenButton: false,
profileAvatar: "xxx.jpg",
params: {
images: {
dims: {
width: 250,
height: 200,
}
},
storage: "XXX",
},
})
</script>
Both need to run through HTTPS. Do I need Apache or something similar? If this is the case, how can I configure it? I dont know if it is relevant but I only have access to the VM through SSH.
It sounds like you might want to use Apache's name-based virtual hosts (see the example under Running different sites on different ports).

Stripe integration with 3D Secure

I have an Express app that I had successfully tested with tokenisation of payments. As I'm in the UK and will be accepting mainly UK cards, I believe I need to implement 3D Secure handling. I'm really struggling to understand the official documentation - examples are few and far between in my opinion. From the following: https://stripe.com/docs/sources/three-d-secure
I have got Sources working instead of Card payments using tokens. This is step 1. Step 2 requires that I determine if the card supports 3D Secure. I have been doing this client side but am not sure how to handle this subsequently - I have been attempting to send the user for a card payment if 3D Secure is not required. BUT if it is required, do i need to create another Source? And do I do this server or client side? I also cannot get the return_url field to do anything - 3D Secure cards simply fail.
Are there any examples out there that would help me? I am finding the official docs simply tell you roughly what to do with not much in the way of 'how' to do things.
I should add I am using v3 with Elements, NOT Checkout.
Thanks for any help.
edit: the below server-side doesn't seem to do anything:
stripe.sources.create({
amount: 6500,
currency: 'gbp',
type: "three_d_secure",
three_d_secure: {
card: stripeSource,
},
redirect: {
return_url: "http://example.com"
}
})
The documentation states "To allow your customer to verify their identity using 3D Secure, redirect them to the URL provided within theredirect[url] attribute of the Source object."
My source object doesn't contain this field?
edit: This is what I have now. The redirect works, but as soon as I authorize the payment, the card declines:
stripe.customers.create({
email: cust_email,
source: stripeSource
}).then(function(customer){
return stripe.charges.create({
amount: fee,
description: "Client Ref: " + clientref,
currency: "gbp",
customer: customer.id,
metadata: {
'allocation:': allocate
},
receipt_email: cust_email,
source: request.query.source,
})
}
).catch(err => {
console.log(err)
})
stripe.sources.create({
amount: fee,
currency: 'gbp',
type: "three_d_secure",
three_d_secure: {
card: stripeSource,
},
redirect: {
return_url: "http://localhost:8000/charge"
}
}).then(function(test) {
response.redirect(test.redirect.url)
})

Google analytics API v4 max results

Can someone please help me for Google analytic API V4:
how to pass: max-result parameter with this class:
Google_Service_AnalyticsReporting
I am unable to find relevant function to assign max-result parameter value.
Based on https://stackoverflow.com/a/38922925/1224827 , the parameter you're looking for is pageSize:
The correct name of the parameter you are looking for is: pageSize. The Reference Docs provide the full API specifications.
def get_report(analytics):
# Use the Analytics Service Object to query the Analytics Reporting API V4.
return analytics.reports().batchGet(
body={
'reportRequests': [
{
'viewId': VIEW_ID,
'pageSize': 10000,
'dateRanges': [{'startDate': '2016-04-01', 'endDate': '2016-08-09'}],
'dimensions': [{'name':'ga:date'},
{'name': 'ga:channelGrouping'}],
'metrics': [{'expression': 'ga:sessions'},
{'expression': 'ga:newUsers'},
{'expression': 'ga:goal15Completions'},
{'expression': 'ga:goal9Completions'},
{'expression': 'ga:goal10Completions'}]
}]
}
).execute()
Note: the API returns a maximum of 100,000 rows per request, no matter how many you ask for (according to the documentation). As you attempted max_results this tells me you are trying to migrate from the Core Reporting API V3, check out the Migration Guide - Pagination documentation to understand how to request the next 100,000 rows.
Stack Overflow extra tip. Include your error responses in your question, as it will likely improve your chances of someone being able to help.
You can use parameter page_size: 10000. Hope this helps.
I checked these docs but couldn't find any example for max-result
v3 doc https://developers.google.com/analytics/devguides/reporting/core/v3/reference#maxResults
v4 batchGet doc https://developers.google.com/analytics/devguides/reporting/core/v4/rest/v4/reports/batchGet
It would be great if someone shares the JSON example of max-result. I'm getting an error message when I add "start-index" : 1 and "max-results": 10
"Invalid JSON payload received. Unknown name \"start-index\" at 'report_requests[0]':
Cannot find field.\nInvalid JSON payload received. Unknown name \"max-results\" at
'report_requests[0]': Cannot find field.", {
Here is my JSON
{
"reportRequests": [
{
"viewId": "112211828",
"dateRanges": [
{
"startDate": "30daysAgo",
"endDate": "yesterday"
}
],
"metrics": [
{
"formattingType": "METRIC_TYPE_UNSPECIFIED",
"expression": "ga:searchUniques"
}
],
"dimensions": [
{
"name": "ga:searchKeyword"
}
],
"orderBys": [
{
"orderType": "VALUE",
"sortOrder": "DESCENDING",
"fieldName": "ga:searchUniques"
}
],
"samplingLevel": "DEFAULT",
"start-index" : 1,
"max-results": 10 // [Uptade] it should be "pageSize": 10
}
]
}
[UPDATE]
"pageSize": 10 is works instead of "max-results"

How to tag a block storage using softlayer api

I can't find any method about tag a block storage in following link:
https://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage_Iscsi
Also I checked the command of tag:
https://sldn.softlayer.com/reference/services/SoftLayer_Tag
This command seems like what I want, but I still met some problems:
For the parameter tagTypes, the supported types I get are:
{'keyName': 'HARDWARE', 'description': 'Hardware'},
{'keyName': 'GUEST', 'description': 'CCI'},
{'keyName': 'ACCOUNT_DOCUMENT', 'description': 'Account Document'},
{'keyName': 'TICKET', 'description': 'Ticket'},
{'keyName': 'NETWORK_VLAN_FIREWALL', 'description': 'Vlan Firewall'},
{'keyName': 'CONTRACT', 'description': 'Contract'},
{'keyName': 'IMAGE_TEMPLATE', 'description': 'Image Template'},
{'keyName': 'APPLICATION_DELIVERY_CONTROLLER', 'description': 'Application Delivery Controller'},
{'keyName': 'NETWORK_VLAN', 'description': 'Vlan'}
Not sure which one is proper for block storage.
I tried with tagType "HARDWARE" and tired to set the tag to block storage, the response shows "You do not have permissions to tag this object"
Anyone can help to give some advice, thanks in advance.
I am affraid that is not possbiel to tag the block storages, the object Network_Storage_Iscsi should have a property called tagReference but as you can see in documentation it does not have it:
https://sldn.softlayer.com/reference/datatypes/SoftLayer_Network_Storage_Iscsi
For example other objects that can be tagged have that property e.g. Tickets or image templates see:
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Ticket
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Virtual_Guest_Block_Device_Template_Group
Addiotionally the method: https://sldn.softlayer.com/reference/services/SoftLayer_Tag/getAllTagTypes
it should return Network_Storage as a valid type, but it does not.
Regards

Filter products with API Magento in Ruby on Rails with Savon gem (SOAP)

I am using this code for my rails app with the API of Magento. Everything is fine except for one thing, i need filter the products by arguments of the Magento API but i don't know how :(
Obviously i have tested with more solutions (array, hash, etc), but
unsuccessful.
Pd: Sorry, my english is very limited
Links
Related case (fail): Adding a product using Savon to connect to Magento API
Example: http://www.polyvision.org/2011/10/02/using-magento-soap-api-with-ruby-and-savon.html
I know this is very late, but if anyone else is finding this thread, I've created a magento_api_wrapper gem that implements filters for the Magento SOAP API v2. You can find the code here: https://github.com/harrisjb/magento_api_wrapper
To summarize, if you want to use one of the Magento SOAP API simple filters, you can pass a hash with a key and value:
api = MagentoApiWrapper::Catalog.new(magento_url: "yourmagentostore.com/index.php", magento_username: "soap_api_username", magento_api_key: "userkey123")
api.product_list(simple_filters: [{key: "status", value: "processing"}, {key: created_at, value: "12/10/2013 12:00" }])
And to use a complex filter, pass a hash with key, operator, and value:
api.product_list(complex_filters: [{key: "status", operator: "eq", value: ["processing", "completed"]}, {key: created_at, operator: "from", value: "12/10/2013" }])
Spent ages getting this to work with Savon - there are no actual solutions on the web. Went and looked at the SOAP call and was missing :item
params = {:filter => {:item => {:key => "status", :value => "closed"}}}
result = client.call(:sales_order_list, message: { session_id: session_id, filters: params})
This will only return orders that are of status closed.
If you are looking to work with Magento and Rails, Gemgento might be what you need. It replaces Magento's front end with RoR.
http://www.gemgento.com
After you sync with Magento you can use the Gemgento::Product.filter method along with some scopes to easily search the EAV structure of Magento.
attribute = Gemgento::Attribute.find_by(code: 'color')
Gemgento::Product.filter({ attribute: attribute, value: 'red' })
The filter method can actually take all sorts of array/hash combos
filters = [
{ attribute: [attribute1, attribute2], value: %w[red yellow black] },
{ attribute: size_attribute, value: 'L' }
]
Gemgento::Product.filter(filters)