Walmart Marketplace Item Variants - walmart-api

I'm trying to set up new items with variant groups via the Walmart marketplace API. I've been able to set up individual items but when I add the info requested for variant groups, The Walmart system wont ingest my items.. I'm using the python requests library with payload data formatted as JSON.
The error message I'm receiving from Walmart (Data Error):
"A variant item must have a Variant Group ID, Variant Attribute Name and 'Is Primary Variant' value. 'Is Primary Variant' should be set to 'Yes' for only one item in a group of variants. Learn more by searching 'Variant Group' in Help documentation to ensure your variant meets all requirements"
The full item spec can be found at: https://developer.walmart.com/image/asdp/us/mp/item/spec/4.4/MP_ITEM_SPEC_4.4.json
Data being sent in "Visible" section:
"Visible": {
"Home Decor, Kitchen, & Other": {
"shortDescription": self.__description,
"mainImageUrl": self.__image_URLs[0],
"productSecondaryImageURL": [
self.__image_URLs[1]
],
"variantGroupId": self.__src_file_name,
"isPrimaryVariant": self.__is_primary_variant,
"variantAttributeNames": [
"size",
"color",
"material"
],
"size": "8x24",
"color": "black",
"material": "wood"
}

Related

How to tell the difference between a SP Online drive and a Teams channel-drive?

Using the MSFT Graph API, is there a way to differentiate Drives (which are documentLibraries) that are used for Team-Channels versus those that are "simply" documentLibraries created WRT a more generic, SharePoint Online Site?
Retrieving a user's /v1.0/sites?search=* returns a union of SPO Sites the user is a member of and Teams the user is a member of. (Yes, Teams are SPO sites or libraries within a site natively.)
I need to differentiate either the Sites by whether or not they're a Team-Site (because I can then filter Drives returned), or specifically all the Drives returned to differentiate whether the Drive is a Channel-Drive or simply a plain-old documentLibrary that is part of a Site.
Retrieving Sites from Graph shows no apparent properties that indicate what "type" of Site it is, and neither do the Drives queried from each Site (/v1.0/sites/SITE-ID/drives).
Thanks.
One of the way can be check the owner of the drive associated with the site
GET https://graph.microsoft.com/v1.0/sites/{siteId}?$expand=drive
That endpoint will return site info including drive info
{
"description": "...",
"id": "xxx",
...
"drive": {
"description": "",
"id": "xxx",
"driveType": "documentLibrary",
...
"owner": {
"group": {
"email": "xxx",
"id": "42857780-3ab6-412d-a9b8-5e6adc73aabb",
"displayName": "xxx"
}
},
"quota": {}
}
If the owner has property group then you can use group id in the following endpoint
GET https://graph.microsoft.com/v1.0/groups/{groupId}?$select=id,resourceProvisioningOptions
Response:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#groups(id,resourceProvisioningOptions)/$entity",
"id": "xxx",
"resourceProvisioningOptions": [
"Team"
]
}
select resourceProvisioningOptions which specifies the group resources that are provisioned as part of Microsoft 365 group creation, that are not normally part of default group creation. If one of the value is Team then the drive is used for teams.
Resources:
group

Is there a common unique identifier for transactions from plaid and QFX file?

Is there a way to uniquely identify a transaction from a QFX file (downloaded from a bank) and the list of transactions fetched from plaid?
There is FITID in the QFX file and transaction_id in plaid transaction list. But is there any common unique identifier for both QFX file and Plaid transaction?
QFX file:
<BANKACCTFROM>
<BANKID>1234
<ACCTID>567890
<ACCTTYPE>CHECKING
</BANKACCTFROM>
<BANKTRANLIST>
<DTSTART>20210430120000[0:GMT]
<DTEND>20210504120000[0:GMT]
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>20210504120000[0:GMT]
<TRNAMT>-99.99
<FITID>202105040
<NAME>TEST TRANSACTION DATA
<MEMO> IN 05/03
</STMTTRN>
</BANKTRANLIST>
Transaction fetched from Plaid API:
{
"account_id": "testaccountid123",
"amount": 99.99,
"category": [
"Shops",
"Clothing and Accessories"
],
"category_id": "123546",
"date": "2021-05-04",
"iso_currency_code": "USD",
"location": {},
"merchant_name": "Test Transaction Data in 05/03",
"name": "TEST TRANSACTION DATA IN 05/03",
"payment_channel": "in store",
"payment_meta": {},
"pending": false,
"pending_transaction_id": "asdf",
"transaction_id": "testtransactionid",
"transaction_type": "place"
}
I think you've kind of answered your own question -- as you can see from the responses you pasted in, there isn't a shared id field across both the QFX file and the Plaid response.
That said, you could probably do some processing on the name, memo, date, and amount fields to match them up and get a very close to accurate correlation between QFX transactions and Plaid transactions.

How to retrieve referenced entities returned by List Assignments

I'm calling the List Assignments endpoint in Microsoft Graph. It returns an array of classes with one of the classes shown below.
How do I unpack the referenced entity microsoft.graph.educationAssignmentClassRecipient to get the recipient list?
{
"classId": "bef6024d-c51d-4c2d-9c4c-4e290581e7b4",
"displayName": "Teleschool Week 5 Formative Grade",
"closeDateTime": null,
"dueDateTime": "2020-04-28T03:59:59Z",
"assignDateTime": null,
"assignedDateTime": "2020-04-24T15:51:00.8911402Z",
"allowLateSubmissions": true,
"createdDateTime": "2020-04-24T15:50:39.9443371Z",
"lastModifiedDateTime": "2020-04-24T15:51:03.7407937Z",
"allowStudentsToAddResourcesToSubmission": true,
"status": "assigned",
"id": "66e4a8f8-42ee-49e0-9503-e24a49be6908",
"instructions": {
"content": "",
"contentType": "text"
},
"grading": {
"#odata.type": "#microsoft.graph.educationAssignmentPointsGradeType",
"maxPoints": 100
},
"assignTo": {
"#odata.type": "#microsoft.graph.educationAssignmentClassRecipient"
}
educationAssignmentClassRecipient {pasted from documentation}:
Used inside the assignment.assignTo property. When set to class recipient, every student in the class will receive a submission object when the assignment is published.
This resource is a subclass of educationAssignmentRecipient.
For an assignment that is handed out to the whole class, it'll contain the classRecipient data type.
For classRecipient, we do not include the full list of userIds. But you can query the ~/groups/{classId}/members API to get the member list OR to see exactly which user's were given out that assignment, you can query the ~/assignments/{id}/submissions list where each submission will contain the recipient/userId property.
For an assignment that was selectively handed out to a subset of students, it'll contains the #odata.type: IndividualRecipient and a recipient's array with the student's userIds.

Getting album, album art, and run time info from musicbrainz

Is there any way of getting a list of albums for an artist (band), along with a link to album art and runtime?
I've been given this endpoint, but the data it returns is confusing:
http://musicbrainz.org/ws/2/recording?query=artist:%22Queen%22%20and%20type:album&fmt=json
The data isn't really organized around albums, and the "length" data returns something like 203000. But it's better if you see it in context, so here's the first bit of it (sorry I couldn't get it indented):
{
"created": "2018-02-17T03:47:57.052Z",
"count": 9533710,
"offset": 0,
"recordings": [
{
"id": "c2e919f7-ecb9-4fdf-9162-3c26d0127fa0",
"score": "100",
"title": "Son and Daughter",
"length": 203000,
"video": null,
"artist-credit": [
{
"artist": {
"id": "0383dadf-2a4e-4d10-a46a-e9e041da8eb3",
"name": "Queen",
"sort-name": "Queen",
"disambiguation": "UK rock group",
"aliases": [
{
"sort-name": "Queen + Adam Lambert",
"name": "Queen + Adam Lambert",
"locale": null,
"type": null,
"primary": null,
"begin-date": "2011",
"end-date": null
}
]
}
}
],
"releases": [
{
"id": "bb19abaf-80b3-4a3e-846d-5f12b12af827",
"title": "Queen",
"status": "Official",
"release-group": {
"id": "810068af-2b3c-3e9c-b2ab-68a3f3e3787d",
"primary-type": "Album"
},
"date": "1994",
"country": "NL",
"release-events": [
{
"date": "1994",
"area": {
"id": "ef1b7cc0-cd26-36f4-8ea0-04d9623786c7",
"name": "Netherlands",
"sort-name": "Netherlands",
"iso-3166-1-codes": [
"NL"
]
}
}
],
"track-count": 10,
"media": [
{
"position": 1,
"format": "CD",
"track": [
{
"id": "3a26455e-2660-30dc-a652-6a2b40f1fbe5",
"number": "8",
"title": "Son and Daughter",
"length": 203400
}
],
"track-count": 10,
"track-offset": 7
}
]
},
{
"id": "1783da6a-9315-3602-a488-1738eb733a0f",
"title": "Queen",
"status": "Official",
"release-group": {
"id": "810068af-2b3c-3e9c-b2ab-68a3f3e3787d",
"primary-type": "Album"
},
"date": "1973-09-04",
"country": "US",
"release-events": [
{
"date": "1973-09-04",
"area": {
"id": "489ce91b-6658-3307-9877-795b68554c98",
"name": "United States",
"sort-name": "United States",
"iso-3166-1-codes": [
"US"
]
}
}
],
If someone can explain this data to me, then I don't need another endpoint. But I've been hunting around the musicbrainz docs and they're not super helpful.
Preferably it would be with one call, but I can do successive calls if necessary.
Thanks for your help.
First off:
Is there any way of getting a list of albums for an artist (band), along with a link to album art and runtime?
Yes, definitely.
First you will want to find the artist, say, the Queen that did Bohemian Rhapsody. They're identified with MusicBrainz Artist ID "0383dadf-2a4e-4d10-a46a-e9e041da8eb3", so you can do a browse request for Releases by this artist: https://musicbrainz.org/ws/2/release/?artist=0383dadf-2a4e-4d10-a46a-e9e041da8eb3&inc=recordings&fmt=json (note the inc=recordings)
This gives you most of what you are asking for. A list of releases and their runtime—kind of. Each Release should have one or more medium properties that in turn have a track-list with a number of tracks. The sum of the length of each of these tracks is what makes up the runtime (the length is given in milliseconds).
For cover art, you may notice that the output has a cover-art-archive property. For cover art, MusicBrainz uses Cover Art Archive which uses MusicBrainz IDs as identifiers. The cover-art-archive attribute states whether any cover art exists in Cover Art Archive and a few details about this—e.g., does CAA have any images at all (artwork)? Does it have a back image (back) and/or a front image (front)? How many images are there in all for the release (count)? If the cover-art-archive→artwork is true, we can go on and fetch cover art from the CAA. The CAA's API is really simple: to get the "front" image of a release, say the 1974 UK single "Killer Queen" that has MusicBrainz Release ID "a2d12ee8-9aeb-4d91-bfab-5c21f7a577fc", you can simply do https://coverartarchive.org/release/a2d12ee8-9aeb-4d91-bfab-5c21f7a577fc/front
You can also do https://coverartarchive.org/release/a2d12ee8-9aeb-4d91-bfab-5c21f7a577fc to get a JSON document with more details about what cover art images are available (e.g., this one has two images: one Front+Medium and one Back+Medium image).
The Cover Art Archive API is documented at https://musicbrainz.org/doc/Cover_Art_Archive/API and the MusicBrainz API/web service documentation can be found at https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2
Note that using browse requests you can page through the results using offset and vary the amount of results per query using limit, see the "Paging" section under the browse request section in the MusicBrainz WS documentation.
Secondly: Though you don't ask about this directly, you're using a search query using a generic term in your question, so I thought I'd talk about this for a bit. In MusicBrainz everything is identified using MusicBrainz identifiers (IDs). (I kind of mentioned them in the first section too.)
The reason for this is that many, many names are not unique. There are as of this writing three unique artists known as "Queen" in MusicBrainz: https://musicbrainz.org/search?query=%22queen%22&type=artist&method=advanced – not counting any of the 321 other artists that have "queen" as part of their name. Without more information, it is not possible for MusicBrainz to know which of them you want to find out information from, so your first step will likely be to somehow either narrow the search (e.g., add type:group narrows the search to 123 results, using country:gb limits to 21 results, doing both gives 11 results (see the search syntax documentation for more details)) or somehow filter afterwards.
Once you've narrowed it down to the specific artist you want, you can continue with the steps outlined above to get the details you want. The steps for narrowing it down will depend on your specific application/use case.
Finally: You seem to have some missing understanding at the asbstract level about how MusicBrainz's data is structured. E.g., all of the above is assuming that by album you mean a specific released version like the 1974 UK "Killer Queen" single, and not a more generic concept of a release like any version of the "Killer Queen" single, which in MusicBrainz terminology would be a Release Group.
https://musicbrainz.org/doc/MusicBrainz_Entity is a list of entities used in MusicBrainz. Understanding the differences between a Release Group and a Release as well as between Tracks and Recordings (and Works) will put you in a much better position to effectively use the web service and the MusicBrainz data in general.
https://musicbrainz.org/doc/MusicBrainz_Database/Schema is a introduction to how MusicBrainz is structured. Knowing how artist credits, ("advanced") relationships, and mediums play into things is also likely to save you a lot of headache later.
You need to understand the format of the data returned, copy the result in to a JSON formatting service such as https://jsonformatter.curiousconcept.com/
You will then realise you have multiple artists in the returned data, which is why it's not as simple as "albums by artist"
I’m guessing the "length" data is in milliseconds.

return certain fields first in elastic search

I have a Rails application with term => definitions stored in nodes on Neo4j that I want my users to search using elastic search. Through usage we've found they far more commonly want to find the term name first before they want to search the description. But I'm having trouble finding the function that returns results for a certain field first over other fields.
[
{
"id": 1,
"data": {
"name": "Foo",
"description": "Something super awesome."
}
},
{
"id": 2,
"data": {
"name": "Bar",
"description": "Something that depends on Foo"
}
}
]
search for "Foo"
Because both terms contain the word Foo in either name or description, my app returns both in alphabetical order and since Bar is alphabetically before Foo, Bar appears first. This can get very tiring when my users search for a common term used in many other terms.
How do I return results from the name field first followed by the secondary results in the description?
I have a feeling this has more to do with neo4j than elastic search
Its possible by Adding term and fields frequency value to your type mapping. http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/scoring-theory.html
name": {
"type": "string",
"store": true,
"norms": {
"enabled": false
},
"index_options": "docs"
}
let me known any queries.

Resources