RESTful API how to check that sevarel items exists - yii2

I am using the mobile application to work with Yii2 RESTful API. In my mobile app I do have a shopping cart with items. So the idea is where user is opening a shopping cart to check that products are still available and have not been sold. So I was thinking to get list of product's id and send a request to RESTful API to check that all of them is fine. If some of them sold I should get back a changed list od products. So far I request my items using this link https://api.website.com/products?product_id=969
What is the good approach to solve this issue? Or in my mobile app I have to create a loop to check each product by one?

A usual practice for use use case you describe is to create an endpoint that accepts a list of IDs, separated by some character (comma, semicolon, etc). For example:
https://api.website.com/products?product_ids=969,970,971
In that action you'd loop over each individual ID in product_ids.

Related

Update shopify inventory automatically

I have a shopify website, but my fulfilment process is done outside of shopify, meaning that when the customer picks a product, it redirects to another service, were the fulfillment is done, and the the purchase is concluded. Because of that, shopify has no way to know if the purchase is concluded or not, so the store has to be updated manually. This is what I would like to avoid.Is is there an app, or a way I can update shopify by sending a json or a CSV with the updated products? And does uploading a CSV with the entirety of my data to repopulate my inventory a valid idea?
I expect there to be an outside service/App that might be able to help automate this, because I am able to receive a Json file (via an api) with all the info of the products that have been purchased, but I don't know how to use it to update shopify.
Even if you fulfill external to Shopify with a service, Shopify can be set to maintain your inventory by removing the sold inventory. Fulfillment does not really come into play.
Regardless though, Shopify does have an API, and there are handy calls that let you update 100 SKUs with a new quantity, in one API call, at one location. So if you have a CSV or JSON file, it is very easy to use that data to update Shopify. Make authenticated API calls. In the store itself, you can generate a token allowing API updates, and you can test with Postman, meaning your total investment in this is near zero.

Can I add new attribute to an existing table in Laravel Dynamically?

I am building Dashboard in Laravel with API to Mobile Application.
In the mobile app there is a container that has a Drop Down list connecting to the API to get Department.
When we choose one of the Department another Drop Down list appear contain Department info.
The problem some Department need to show another Drop Down list to choose. For example (the manufacture company) but some Department don't need that.
How can I deal with this problem in database? Is there any way to store this in my database without having null record.
If there is a way how I can send the data in API to mobile app to read the attribute that need to fill?

Search Members using MailChimp API 3.0 by Merge Field

Is is possible to search for members in a MailChimp list by merge field using the MailChimp API v3.0?
The documentation for the Search Members endpoint links to a separate page, Search for Campaigns and Contacts in Your Account, which details how to manually search using the GUI, but mentions that the keyword search can include merge fields in the format merge3:keyword, so it looks like it should be possible.
However, in both the GUI and using the MailChimp API php wrapper, I get no results - the GUI returns the error Invalid search request, try again, while the php API returns an empty array with nothing in getLastError() or getLastResponse().
Searching using a subscriber's name or email address does, however, work as expected.
As mentioned by #Kalyan Sangartula it is not possible to search using other merge fields.
But I think an alternative, for now, to this could be using segments. You can create segments based on filters you want (api route "/lists/{list_id}/segments") and get members from those segments (api route "/lists/{list_id}/segments/{segment_id}/members").
"/search-members" endpoint only supports merge1, merge2, and merge3 fields (the Email, Fname, and Lname) fields for members. It doesn't support any other fields or merge fields except the mentioned above.
Sample API call for search-members: "/3.0/search-members?query=abc#example.com"

Can groups be expanded when querying which students are associated with a class notebook?

We currently query for the list of students associated with a class notebook via:
/api/v1.0/me/notes/classnotebooks/{id}/students
Should a group be associated with the class notebook then we get principalType=Group and an id in the form:
c:0o.c|federateddirectoryclaimprovider|{id}
So is it possible to expand the members of the associated group(s) within this call? If not, what is the format of this id? To use it via the graph api requires an id so is it safe to assume that the id will always be the 3rd piped element?
Thanks
I ran into this for my application as well. After conferring with the onenote team a few months ago it came down to that you cannot expand these groups inside the onenote api. You must authenticate to the graph api and use the groups functions there. The downside of this is that the graph api permissions to expand a group require an administrator to grant them. So in the end all I could do was recommend the users create class notebooks using the student email list rather than an azure group. (on your final point the format should remain consistent the third piped element is the group id you can pass the graph api)
specifically the below endpoint to get a groups members
'https://graph.microsoft.com/v1.0/myorganization/groups/' . $group_id . '/members'

How to populate a jQuery Mobile list view of cities from Open Weather Map API?

I am trying to write a very basic jQuery Mobile app that will allow someone to select a city and view the current temperature using the OpenWeatherMap API. The data I want to use will be returned as json.
As per the landing page I can see that doing the query explicitly with the city is fine...
http://api.openweathermap.org/data/2.5/weather?q=London,uk
But what I am unable to find is how do I query the API to simply return all the cities, which will then subsequently allow me to populate my list view, then allowing the user to see the temperature.
I have read some people talking about using a 'callback', but I am unable to see how this would help.
I have written a basic app previously, but again, that was using a fixed location, where the user didnt have to select it, so I never ran into this problem before.
I am having problems posting my code, but will attempt to post it later this eve.
Any pointers/tutorial links would be great.
You have to contact them via email to get the latest list of countries.