Magento 2 Rest Api V1/products missing extension attributes - rest

I am calling the Rest API V1/products to get the product list from Magento 2 store
Request:
http://{myMagentohost}/Magento/index.php/rest/V1/products?searchCriteria[currentPage]=1&searchCriteria[pageSize]=1
Response:
{"items": [ { "id": 1,"sku": "24-MB01","name": "Joust Duffle Bag","attribute_set_id": 15,"price": 34,"status": 1,"visibility": 4,"type_id": "simple","created_at": "2017-06-13 09:36:11","updated_at": "2017-06-13 09:36:11","product_links": [{"sku": "24-MB01", "link_type": "upsell","linked_product_sku": "24-MB03","linked_product_type": "simple","position": null,"extension_attributes": []},{"sku": "24-B01","link_type": "upsell","linked_product_sku": "24-WB04","linked_product_type": "simple","position": null,"extension_attributes": []}],"options": [],"tier_prices": [],"custom_attributes": [{"attribute_code": "description","value": "<p>The sporty Joust Duffle Bag can't be beat - ot in the gym, not on the luggage carousel, not anywhere. Big enough to haul a basketball or soccer ball and some sneakers with plenty of room to spare, it's ideal for athletes with places to go.<p>\n<ul>\n<li>Dual top handles.</li>\n<li>Adjustable shoulder strap.</li>\n<li>Full-length zipper.</li>\n<li>L 29\" x W 13\" x H 11\".</li>\n</ul>"},{"attribute_code": "image","value": "/m/b/mb01-blue-0.jpg"},{"attribute_code": "small_image","value": "/m/b/mb01-blue-0.jpg"},{"attribute_code": "thumbnail","value": "/m/b/mb01-blue-0.jpg"},{"attribute_code": "url_key","value": "joust-duffle-bag"}]}],"search_criteria": {"filter_groups": [],"page_size": 1,"current_page": 1},"total_count": 2046}
Now according to the Magento 2 Rest API swagger documentation,
catalogProductRepositoryV1, GET /V1/products in response it shows the extension_attributes but when I actually call this api from postman extension_attributes is missing.
I search for it but no appropriate solution is available.
Can anyone help in this matter?
Thanks!

We are using M2Ent Cloud Edt and we have an open ticket with Magento support who confirm this is a problem with the REST API.
To circumvent, we initially looped through all products via V1/products using pagination (Fastly as a 60s timeout otherwise), and then called V1/products/{sku} to get all the details (which correctly includes the extension_attributes node.
They have not given us an ETA on a fix.

Related

Using additional request parameters in Twitter Premium Search API

I am using the Twitter API from Matlab, specifically by means of the twitter class from the Datafeed Toolbox.
I have essentially followed the example code from the official documentation. I created a Twitter app in my Twitter developer page, and obtained its API keys and access tokens. With those I can use the Twitter Standard search API from Matlab:
c = twitter(consumerkey,consumersecret,accesstoken,accesstokensecret);
% The variables 'consumerkey' etc are defined as character vectors
s = search(c,tweetquery,'count',100); % this works
Now I want to use the Premium search API. This has two endpoints for accessing Tweets:
30-day endpoint: provides Tweets from the previous 30 days.
Full-archive endpoint: provides complete and instant access to Tweets dating all the way back to the first Tweet in March 2006.
In addition, the Premium API has two tiers of access:
Free Sandbox access that enables initial testing and development.
Paid Premium access that provides increased access.
The link above specifies the restrictions associated to sandbox as compared with paid access.
I am trying to use the full-archive endpoint with sandbox access. For that I had to create a developer environment on Twitter, which I named dev.
The search method in Matlab's twitter class (which worked for the Standard access, as described above) doesn't seem to work with the Premium access. But I noticed that search actually calls getdata, and the latter does work for Premium access as follows. First, the Premium access URL needs to be defined:
c.URL = 'https://api.twitter.com/1.1/tweets/search/fullarchive/dev.json';
and then the following syntax works:
s = getdata(c,c.URL,'query','Jimi Hendrix'); % this works
I have also been able to add operators within the query string, for example to specify a range of geographical positions or to restrict the search to tweets that contain images:
s = getdata(c,c.URL,'query','place:"Palo Alto"'); % this works
s = getdata(c,c.URL,'query','Robert Smith bounding_box:[-0.2 51.4 0.1 51.6]') % this works
However—and this is my question—, I haven't been able to use additional request parameters defined in the Twitter API to refine the search, such as fromDate, toDate or maxResults:
s = getdata(c,c.URL,'query','John Frusciante', 'fromDate', '201708130000') % doesn't work
s = getdata(c,c.URL,'query','Rob Scallon', ...
'fromDate', '201708130000', 'toDate', '201708150000') % doesn't work
s = getdata(c,c.URL,'query','Michael Lemmo', 'maxResults', '20') % doesn't work
All of the above return an HTTP/1.1 422 Unprocessable Entity error.
Is my syntax not correct? Maybe the fromDate etc parameters have to be part of the query string? Or maybe the sandbox tier of the Premium search doesn't support those parameters?
For context, I don't really know what all those terms like endpoint, tier, developer environment and token mean, but still I'd like to make this work.
Going by the description at https://developer.twitter.com/en/docs/tweets/search/api-reference/premium-search#DataParameters, what you call 'addition request parameters' are defined for requests of type POST /search/:product. These are HTTP POST requests, can you try using postdata (https://in.mathworks.com/help/datafeed/twitter.postdata.html) instead of getdata. Their usage is almost identical.

Custom Dimensions Not Reporting Through to Google Analytics API V4

I am attempting to pass information collected as, "custom dimensions," from Google Tag Manager through Google Analytics and then extract them out via the Google Analytics V4 API.
I have set up four of the fundamental custom dimensions suggested by Simo Ahava in this article.
My variable setup looks like the following:
variable setup
Essentially, I have been able to successfully pass through userID_dimension, hittimestamp_dimension, clientid_dimension and sessionid_dimension to the Google Analytics dashboard, but for some reason I am not able to extract out the hittimestamp_dimension through the API.
Here's what I am able to see on the dashboard:
Google Analytics Dashboard
As far as the API itself, I am using the HelloAnalytics.py python version supplied by Google, and I am able to extract out all of the above information, minus the timestamps dimensions on the right hand side of each.
I'm storing the timestamp information in dimension2, but upon making the below call (again, using API V4) I get blank...nothing.
analytics.reports().batchGet(
body={
'reportRequests': [
{
'viewId': VIEW_ID,
'dateRanges': [{'startDate': '2017-10-05', 'endDate': '2017-10-06'}],
'samplingLevel': 'LARGE',
'dimensions': [{'name': 'ga:dimension4'},{'name': 'ga:dimension2'}]
}]
}
).execute()
Upon making this call, one would expect that the above would report out dimensions similar to what the Google Analytics dashboard would show. E.g. one would think that the dashboard itself is using the API. However what prints out is blank. All other custom dimensions print out as expected.
If I try to call the above function on just dimension2 itself with no other dimension, it is also blank.
Is there something special one has to do in order to extract hit-scoped variables within the API? Or does the API just not allow hit-scoped variables to pass through?
thanks,
You forgot to add a 'metrics' field to your request, it is required as per documentation
Source: Reporting API v4 - Method: reports.batchGet
The metrics requested. Requests must specify at least one metric. Requests can have a total of 10 metrics.
The below modified request should work:
analytics.reports().batchGet(
body={
'reportRequests': [
{
'viewId': VIEW_ID,
'dateRanges': [{'startDate': '2017-10-05', 'endDate': '2017-10-06'}],
'samplingLevel': 'LARGE',
'dimensions': [{'name': 'ga:dimension4'},{'name': 'ga:dimension2'}],
'metrics': [{'expression': 'ga:sessions'}]
}]
}
).execute()

How to limit Bing Search API V5 to search specific sections of the website

Using bing.com, I can do a search like this (click here for link):
history site:berkeley.edu/about/
When I try the same using the API, I get very different results. As far as I can tell, the search results returns webpages that are not hosted in berkeley.edu (see bottom).
this is the HTTP GET request being made to Azure
https://api.cognitive.microsoft.com/bing/v5.0/search?q=history+site:berkeley.edu/about/&count=10&offset=0
This is my HTTP GET code
$.ajax({
url: "https://api.cognitive.microsoft.com/bing/v5.0/search"
, data: { "q":encodeURI("history+site:berkeley.edu/about/"), "count":"10", "offset":"0" }
, beforeSend: function(xhrObj){
xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","supply-your-key-here");
}
, type: "GET",
})
Any ideas what I could be doing wrong? Thanks
edit1: Seems my "problem" is related to the way AJAX is making the HTTP request. If I supply my key by using a Firefox header plugin and type this (https://api.cognitive.microsoft.com/bing/v5.0/search?q=history+site:berkeley.edu/about/&count=10&offset=0) on my browser URL box, I get the correct response.
search results using API
Environmental Design Library | UC Berkeley Library: A branch of the UC Berkeley Library system, the Environmental Design Library supports the research and teaching of the College of Environmental Design.
Proceedings Template - WORD - ideals.illinois.edu: "(c) ACM, 2007. This is the authors’ version of the work. It is posted here by permission of ACM for your personal use. Not for redistribution.
Trends in metadata practices: A longitudinal study of ...: Trends in metadata practices: A longitudinal study of collection federation. ... A Longitudinal Study of Collection Federation Carole Palmer Oksana ...
http://aerospaceutility.tripod.com/ · GitHub: Clone via HTTPS Clone with Git or checkout with SVN using the repository's web address.
HS RWC Colorado Sample Instructional Units - LiveBinder: Loading Livebinder HS RWC Colorado Sample Instructional Units HS Read Write Communicate Sample Instructional Units provided by the Colorado Department of Education.
Arroyo High School: News Archive: News Archive SIA Awards "As the school year comes to a close, the Students in Action club would like to honor three students for their lasting impact on our ...
English 12 (exp) | Utah Electronic High School: Please be mindful of the fact that this course is not a credit "quick fix." It is a rigorous, college-preparatory class that is both time and labor intensive.
Working SMARTer, not Harder: SOCIAL STUDIES ONLINE ...: SOCIAL STUDIES ONLINE RESOURCES AND LINKS COMPILATION beta List of Social Studies online resources and links to professional development opportunities ...
The Big List -- 20121008 - Grolier: The Big List -- 20121008: 1: EA: http://www.stanford.edu/group/bipolar.clinic/ Stanford Bipolar Disorders Clinic: 2: EA: http://www.mhsource.com/bipolar/
Spreadsheet of Conference Attendees - studylib.net: ÐÏ à¡± á > þÿ ] þÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ...
You can use Bing custom search alternately to make sure you get results only from the domain/webpages you want. Here is the call: https://api.cognitive.microsoft.com/bingcustomsearch/v7.0/search. You will need a different accesskey though, which you can get from customsearch.ai.
I'm getting correct results on both v5.0 and v7.0.
There seems nothing wrong with your query.
https://api.cognitive.microsoft.com/bing/v5.0/search?q=history+site:berkeley.edu/about/&count=10&offset=0
Perhaps you are caching results somewhere in your browser?
Update: Since IE does it, but Firefox doesn't. Have you disabled cache on IE?

Yahoo finance webservice API

I am trying to get realtime stock data from BSE and NSE using yahoo finance web-services. I was able to get some data using following URL
http://finance.yahoo.com/webservice/v1/symbols/COALINDIA.NS/quote?format=json
But it gives me very limited information.
{
"list": {
"meta": {
"type": "resource-list",
"start": 0,
"count": 1
},
"resources": [
{
"resource": {
"classname": "Quote",
"fields": {
"name": "COAL INDIA LTD",
"price": "367.649994",
"symbol": "COALINDIA.NS",
"ts": "1418895539",
"type": "equity",
"utctime": "2014-12-18T09:38:59+0000",
"volume": "2826975"
}
}
}
]
}
}
I need more information like yearly high, low, last traded price etc. and I couldn't find any documentation related to this from yahoo where it details how to get more information.
Is there documentation available related to these services? Or please suggest if there are any alternatives available.
I don't know where the definitive documentation might be but for your particular example try appending &view=detail to your URL.
http://finance.yahoo.com/webservice/v1/symbols/COALINDIA.NS/quote?format=json&view=detail
This will at least give you the year_high and year_low that you asked after.
Now, even though the following won't work for your COALINDIA.NS symbol (I suspect the exchange is not supported), it might be worth exploring the following two examples:
Example 1: As before, but for Apple and Yahoo symbols, with &view=detail appended:
http://finance.yahoo.com/webservice/v1/symbols/YHOO,AAPL/quote?format=json&view=detail
Example 2: And now using a completely different url, resulting in much more response data. One key caveat is this data is delayed by 15 minutes:
http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20IN%20(%22YHOO%22,%22AAPL%22)&format=json&env=http://datatables.org/alltables.env
If you discover the major differences between those two options and what impact they might have then please do let us all know; I'd be interested in finding out more.
If you are fine with getting NSE qoutes, you can use this package for the purpose, it is extremely easy to setup.
http://nsetools.readthedocs.org/en/latest/index.html
Since it uses NSE website/services as data source, the quotes will not be delayed (max few seconds).
Beware that these data are both delayed and inconsistent. You are not getting anything even remotely close to tick or real-time data.
From example 2, refresh a few times, and inspect the "LastTradeWithTime" key-value pair. I sometimes get different quotes from different times of day, for no apparent reason. They are sometimes delayed up to three hours.
You get what you pay for; in other words, this is not a free lunch.
For those who are curious about the different options available in the Yahoo Finance URLs, I think these links might help. If it's not what you're looking for, sorry.
http://internetbandaid.com/2009/03/31/yahoo-stocks-api/
https://ilmusaham.wordpress.com/tag/stock-yahoo-data/
Note: the wordpress site contains information that was taken from a site called gummy-stuff.org which is listed in full at the bottom of the above site (I can only list 2 urls in this post so I had to do the round-about way). Oddly, I found this site on my own yesterday. Funny how stuff comes back around. If you visit this site you'll just see a statement from Yahoo that the info he had originally listed (you're looking at some of this site on the above wordpress site) was never intended to be for public consumption and is a violation of Yahoo's terms and conditions agreement as it can apparently be used for hacking purposes. I was curious to see what was on the original post so I searched for it on the WayBack Machine. BTW, the links to the spread sheets are still active in the archive.
Cheers. Thom

Nokia MapImage Route REST API max. number of POIs

We are using Route REST API and we experience problem when passing many POIs to HTTP request (parameters "poixN"). Our request has about 1000 POIs and some of them are truncated (hard to count, but definitely not all are shown). Here's an example request (first line is URL, the others are parameters passed with POST):
http://maps.nlp.nokia.com/mia/1.6/route?app_code=<APP_CODE>&app_id=<APP_ID>
h=440
w=1030
poix0=52.2420610745,21.0951604874;FFFFEA00;FFFFEA00;1;.
poix1=52.2420610745,21.0952168365;FFFFEA00;FFFFEA00;1;.
poix2=52.2420610745,21.0951024308;FFFFEA00;FFFFEA00;1;.
poix3=52.2047067699,20.9944339802;FFFFEA00;FFFFEA00;1;.
...
poix940=52.1749134848,20.9056261531;FFEE7AFF;FFEE7AFF;1;.
q=100
Is there a limit for number of POIs? What about other parameters like "r"?
We use enterprise version. Thank you in advance.
Edit
Ok, after some research I know the limit for "poixN" is 99. Any way to increase the limit?
I don't think it is possible to increase the number of POIs available using the Map Image API, but it would be possible to obtain a screenshot of a more complex map using the Enterprise Maps API for JavaScript using the ContextMenu.captureHandler
You can add the captureHandler to a context menu as shown:
var contextMenu = new nokia.maps.map.component.ContextMenu();
contextMenu.addHandler(nokia.maps.map.component.ContextMenu.captureHandler);
map.components.add(contextMenu);
You can then obtain a screenshot with all your POIs, which could then be used for printing for example.The HERE Maps Community on GitHub hosts a working example specifically for printing which uses hi-res tiles from the Map Tile API as well. Note that screen capture only works on the Firefox Browser.
Since you have such a high number of POIs, I would also recommend looking at clustering to avoid overwhelming your users with too much information.