Missing product attributes in Commerce.js API response - api

I've had an issue when sending requests to fetch products from the Commerce.js API.
It's that I cannot retrieve the list of attributes I set for each product from the UI that this service provides.
Product Attributes
API Response
In the API docs, it is shown that it's possible to fetch the attributes of each product.
Otherwise, would you please suggest any alternative to Commerce.js that is highly customizable?

I had the same problem. In case you used Commerce SDK, I tried that at first but it seems that it doesn't return the attributes. Instead you can try retrieving the products using the fetch API with the secret key. That worked for me

Make sure the Attribute itself set to Visible, it's by default Private that can't be fetched

Related

Shopify API Customer sort incorrectly unlike other resources(Product, Order, etc)

I am building a shopify app by using the Shopify API, and run into trouble.
When I make a GET request with '/admin/customers.json'
Shopify API response with results sort incorrectly unlike other resources(Product, Order, etc)
I make some screenshots to get thething clear.
Both Order and Product reponse with the correct collection result("updated_at desc") but Customer didn't.
Is it bug or did I miss anything?
I think you need to encode your parameters. Shopify docs don't show encoded params for clarity but you need:
'?fields='+encodeURIComponent('id,updated_at')+
'&updated_at_min='+encodeURIComponent('2015-11-25 20:01:00')+
'&order='+ encodeURIComponent('updated_at DESC');
You could use the search endpoint on customer.
/admin/customers/search.json
/admin/customers/search.json?order=updated_at DESC&fields=id
See the doc on the same API page as customer, just a bit further down the page
https://docs.shopify.com/api/customer
Use the 'sorty_by' attribute when doing your search: https://shopify.github.io/js-buy-sdk/api/classes/ShopClient.html#method-fetchQueryCollections

Magento rest api resources

I have an android application connected to magento server by rest api. The application must preform some actions, but I have no examples of requests needed for the application.
For example I have this list of requests, but it is superficial enough for my application. For example, I do request:
"http://myUrl.com/api/rest/products?limit=15" and receive the list of 15 products. But after I need to receive next 15 product, and next, and next... What request can do it?
Also I need to do another requests which have no in site examples.
Where can I get more information and examples about rest api requests? Thank You in advance.
You can use various get filters available for REST request in magento GET FILTERS. To access second page you can use page filter available i.e. "http://myUrl.com/api/rest/products?limit=15&page=2". You can also combine many filters and use them as you want. Eg. For getting a result of products which have their name like 'product123', you can use: magentohost/api/rest/products?filter[1][attribute]=name&filter[1][like]=%product123%.

POST Order with values for configurable product fields?

I've successfully got 3rd party merchant orders posting new orders to my client's BigCommerce store programmatically. I've even got product options posting as part of the order (product->option set-> option relationships are a total cluster).
My client relies heavily on configurable fields. I'm able to pull the definitions of the configurable fields for each product, but can't find a way to POST or update the configurable field values through the API.
Is it possible to manipulate an order's configurable fields through the API?
Got a response from the support team # BigCommerce. Manipulating configurable fields via the API is not currently possible and not currently on the roadmap.
Original reply below:
Unfortunately that is a product limitation with the API, it will not tie to configurable fields on the product. The best you can do is attach that information through a generic text field like 'staff_notes'. Honestly I have not heard of any talk of adding a way to add products with configurable fields to orders via the API. I think this may be because anything that can be done with configurable fields can be done with options and options are what is being pushed for the future. I have noted this feedback down though and will pass it along to our Product Manager for the API. Best case scenario is that it may be seen in a future version of the API which is at least several months away.

BigCommerce JavaScript API

In BigCommerce, can I access the current customer's record using JavaScript?
I want to change something on the product page based on the customer group that the current customer is in.
there is no JS SDK yet for Bigcommerce. However, because the APIs are restful, you should be able to execute a simple GET request to get a customer's record. The only challenge is that you need to get the customer ID/info when they login to the store and then get their record.
There is an example on Bigcommerce forums on using Javascript to hide pricing for customers who are not logged in.
http://forum.bigcommerce.com/f4/global-variable-for-current-user-s-group-1815/index2.html
This combined with GET request on the customer endpoint (http://developer.bigcommerce.com/api/customers) should get you moving in that direction.
Does this help? Are you looking for a code sample?
Use Javascript or jQuery to do the IF statement.
Then use Ajax to request the data that you want to display to the user.
So to answer your question, directly with Javascript you can't, but combine it with some PHP and then you use the API to do what you would like.
Hope this helps :)

Getting current Product ID with Shopify API for a Javascript API call

I'm toying with developing a Shopify App that uses the DaisyAPI dynamic image service for Shopify. In order to make the correct call to the Daisy API, I need to know what Product the customer is looking at. It seems like, to reliably do that, I will need to manipulate their product.liquid theme to insert a hidden value containing the Product ID so that Jquery can pick up that value and insert it into the API call.
What's the best way to ensure every product page contains the product ID in such a way jQuery can reliably find it? Am I overlooking something obvious?
Many thanks!
Another option would be to use the Ajax API to request the product. Of you know you're on a product page simple make a request to the same URL and append .json. You will then have a json representation of the product that you can do whatever yo want with.
To get you js into the theme you can use a script tag which will load js from you server onto the shop.
You are missing a very obvious and cool Liquid filter.
In Liquid, pump the Object for it's JSON.
var p = {{ product | json }};
And then go to town... you cannot go far on the client without this concept. Get the JSON man.. get the JSON...