Sql Json - Update Json Property within an Array using SQL Server 2017 Express - sql

i Have this Json:
{
"pType": "1",
"pTitle": "A Product",
"pProds": [{
"formM": 1,
"sDesc": "A Product",
"lDesc": "A Product",
"pColor": "#000000",
"pSize": "L",
"postage": "2",
"quatity": 2,
"aPrice": "2",
"rPrice": "2",
"Discounted": "2",
"Price": "2",
"p_Num": "466ff237439a44be9d8fcc4725c28e4c",
"images": [{
"mN": 1,
"idImage": "image1",
"fileName": "39b06cc1aeb94e0c868d9b4e8174e2d5.jpeg",
"bytes": "/img/ProdImages/466ff237439a44be9d8fcc4725c28e4c/39b06cc1aeb94e0c868d9b4e8174e2d5.jpeg"
}]
}, {
"formM": 0,
"sDesc": "",
"lDesc": "",
"pColor": "",
"pSize": "0",
"postage": "0",
"quatity": 0,
"aPrice": "0",
"rPrice": "0",
"Discounted": "0",
"Price": "0",
"p_Num": "b8cf1caa638b48a2a3111b6d78c90b74",
"images": []
}]
}
What i would like to do is update the quatity (miss spelled) value by a given id which is p_Num.
So if i needed to update quatity from 2 to 55 by p_Num equalling '466ff237439a44be9d8fcc4725c28e4c'
How would i achieve this?

Related

Get specific value from json field based on last created_at date

I am using retool, which uses AlaSQL to query JSON, trying to get the value from a field that has multiple items; I only want to return the value of the field stock for the key with the latest created_at date.
select tracked_products
from {{ean.data}}
where created_at=(select MAX(created_at) from {{ean.data}});
I can actually get to the fields I want to like this but I do not understand how to filter further
select tracked_products
from {{ean.data}}
where price < 40
result from above query in plain text
[
{
"id": 172165913,
"offer_data_id": 2208536,
"stock": 2,
"sold": 0,
"revenue": "0.00",
"price": 39.99,
"status": "success",
"created_at": "2022-12-16T12:12:26.000000Z",
"updated_at": "2022-12-16T12:12:26.000000Z"
},
{
"id": 173409443,
"offer_data_id": 2208536,
"stock": 2,
"sold": 0,
"revenue": "0.00",
"price": 34.99,
"status": "success",
"created_at": "2022-12-17T03:15:58.000000Z",
"updated_at": "2022-12-17T03:15:58.000000Z"
},
{
"id": 174659591,
"offer_data_id": 2208536,
"stock": 2,
"sold": 0,
"revenue": "0.00",
"price": 34.99,
"status": "success",
"created_at": "2022-12-18T16:22:45.000000Z",
"updated_at": "2022-12-18T16:22:45.000000Z"
},
{
"id": 175895075,
"offer_data_id": 2208536,
"stock": 2,
"sold": 0,
"revenue": "0.00",
"price": 34.99,
"status": "success",
"created_at": "2022-12-19T03:18:53.000000Z",
"updated_at": "2022-12-19T03:18:53.000000Z"
},
{
"id": 177134025,
"offer_data_id": 2208536,
"stock": 2,
"sold": 0,
"revenue": "0.00",
"price": 34.99,
"status": "success",
"created_at": "2022-12-20T15:35:48.000000Z",
"updated_at": "2022-12-20T15:35:48.000000Z"
},
{
"id": 178391290,
"offer_data_id": 2208536,
"stock": 2,
"sold": 0,
"revenue": "0.00",
"price": 34.99,
"status": "success",
"created_at": "2022-12-21T03:09:22.000000Z",
"updated_at": "2022-12-21T03:09:22.000000Z"
},
{
"id": 179654380,
"offer_data_id": 2208536,
"stock": 1,
"sold": 1,
"revenue": "34.99",
"price": 34.99,
"status": "success",
"created_at": "2022-12-22T03:13:50.000000Z",
"updated_at": "2022-12-22T03:13:50.000000Z"
},
{
"id": 180918092,
"offer_data_id": 2208536,
"stock": 1,
"sold": 0,
"revenue": "0.00",
"price": 34.99,
"status": "success",
"created_at": "2022-12-23T03:19:42.000000Z",
"updated_at": "2022-12-23T03:19:42.000000Z"
}
]
try this :
SELECT DISTINCT
(array_agg(j->>'stock') OVER (PARTITION BY tracked_products ORDER BY j->>'created_at' DESC)[1] AS stock
FROM ean.data
CROSS JOIN LATERAL jsonb_path_query(tracked_products :: jsonb, '$[*]') AS j
WHERE price < 40
This query relies on a text sorting on created_at which should be compliant with the actual date format of this text field.
jsonb_path_query is used instead of json_array_elements so that to avoid an error when tracked_products is not a json of type array.
see dbfiddle
Refer to the manual for more info about json manipulation

JPA - Create document tree with specific elements from database

I have a web app where you select documents and display them. The document tree is generated from a sql table with a one to many relationship on itself.
What it looks like on the frontend
This tree is generated from an sql table with the following columns :
(page_id, position, title, version, parent_id)
The sql table in question
I can already query this table and retrieve a tree like the following :
{
"position": 0,
"version": 51,
"children": [
{
"position": 0,
"version": 51,
"children": [
{
"position": 0,
"version": 51,
"parentId": "2",
"id": "5",
"name": "Page 1"
},
{
"position": 1,
"version": 51,
"parentId": "2",
"id": "6",
"name": "Page 2"
},
{
"position": 2,
"version": 51,
"parentId": "2",
"id": "7",
"name": "Page 3"
}
],
"parentId": "1",
"id": "2",
"name": "Category 1"
},
{
"position": 1,
"version": 51,
"children": [
{
"position": 0,
"version": 51,
"parentId": "3",
"id": "8",
"name": "Page 4"
},
{
"position": 1,
"version": 51,
"parentId": "3",
"id": "9",
"name": "Page 5"
},
{
"position": 2,
"version": 51,
"parentId": "3",
"id": "10",
"name": "Page 6"
},
{
"position": 3,
"version": 51,
"children": [
{
"position": 0,
"version": 51,
"parentId": "4",
"id": "11",
"name": "Page 7"
},
{
"position": 1,
"version": 51,
"parentId": "4",
"id": "12",
"name": "Page 8"
},
{
"position": 2,
"version": 51,
"parentId": "4",
"id": "13",
"name": "Page 9"
}
],
"parentId": "3",
"id": "4",
"name": "Category 3"
}
],
"parentId": "1",
"id": "3",
"name": "Category 2"
}
],
"parentId": "0",
"id": "1",
"name": "Doc Root"
}
This is the entity class :
#Entity
#Table
#AllArgsConstructor
#NoArgsConstructor
#Getter
#Setter
#JsonInclude(JsonInclude.Include.NON_EMPTY)
public class Node {
#Id
#JsonProperty("id")
private Long pageId;
public String getPageId() {
return pageId.toString();
}
#ManyToOne(cascade = CascadeType.ALL)
#JsonBackReference
#JoinColumn(name = "parent_id")
private Node parent;
public String getParentId() {
return parent.getPageId();
}
private Long position;
private Long version;
#JsonProperty("name")
private String title;
#OneToMany(mappedBy = "parent")
#OrderBy(value = "position asc")
#JsonManagedReference
private List<Node> children;
}
What I am trying to do is to retrieve only parts of this tree depending on the selected nodes. For reference, with the above selections, I'd like to receive a tree with the following content :
{
"position": 0,
"version": 51,
"children": [
{
"position": 0,
"version": 51,
"children": [
{
"position": 0,
"version": 51,
"parentId": "2",
"id": "5",
"name": "Page 1"
},
{
"position": 1,
"version": 51,
"parentId": "2",
"id": "6",
"name": "Page 2"
},
{
"position": 2,
"version": 51,
"parentId": "2",
"id": "7",
"name": "Page 3"
}
],
"parentId": "1",
"id": "2",
"name": "Category 1"
},
{
"position": 1,
"version": 51,
"children": [
{
"position": 3,
"version": 51,
"children": [
{
"position": 0,
"version": 51,
"parentId": "4",
"id": "11",
"name": "Page 7"
},
{
"position": 1,
"version": 51,
"parentId": "4",
"id": "12",
"name": "Page 8"
},
{
"position": 2,
"version": 51,
"parentId": "4",
"id": "13",
"name": "Page 9"
}
],
"parentId": "3",
"id": "4",
"name": "Category 3"
}
],
"parentId": "1",
"id": "3",
"name": "Category 2"
}
],
"parentId": "0",
"id": "1",
"name": "Doc Root"
}

All data from first table is not showing proper data in sql

I am trying to add two tables, in which first table contains all the video details, and in second table details of video seen by the user with user_id and video_id. I just want to add both the tables and it will show all the list of videos from first table but if the video is seen by the user, status will show 1 else 1.
Here is my query,
SELECT
videos.id, videos.lang_id, videos.medical_type_id, videos.name,
videos.description, videos.thumbnail, videos.video, videos.video_type,
videos.delete_status,
CASE
WHEN video_quews.user_id = $user_id
THEN $user_id
ELSE 'ok'
END AS user_id,
video_quews.video_id, video_quews.created_at,
CASE
WHEN video_quews.video_id = videos.id
THEN 1
ELSE 0
END AS status
FROM
videos
LEFT JOIN
video_quews ON videos.id = video_quews.video_id
ORDER BY
video_quews.video_id DESC
Currently, videos are repeating.
Please help me out
here is my response,
{
"message": "All related videos",
"status": "success",
"code": 200,
"videos": [
{
"id": "30",
"lang_id": "2",
"medical_type_id": "15",
"name": "Fracture",
"thumbnail": "thumbnail_images/1579869167.png",
"video": "videos/fracture.m4v",
"video_type": "2",
"delete_status": "1",
"user_id": "6",
"video_id": "30",
"created_at": "2021-03-04 23:29:50",
"status": "1"
},
{
"id": "16",
"lang_id": "2",
"medical_type_id": "14",
"name": "Electrocution",
"thumbnail": "thumbnail_images/1579698529.png",
"video": "videos/ELECTROCUTION.m4v",
"video_type": "2",
"delete_status": "1",
"user_id": "ok",
"video_id": "16",
"created_at": "2021-03-05 08:19:29",
"status": "1"
},
{
"id": "15",
"lang_id": "2",
"medical_type_id": "13",
"name": "Adult CPR & AED(Cardiac Arrest)",
"thumbnail": "thumbnail_images/1579698505.png",
"video": "videos/CPR1.mp4",
"video_type": "2",
"delete_status": "1",
"user_id": "ok",
"video_id": "15",
"created_at": "2021-03-05 08:18:38",
"status": "1"
},
{
"id": "14",
"lang_id": "2",
"medical_type_id": "12",
"name": "Choking",
"thumbnail": "thumbnail_images/1579698405.png",
"video": "videos/Choking.mp4",
"video_type": "2",
"delete_status": "1",
"user_id": "ok",
"video_id": "14",
"created_at": "2021-03-05 08:17:47",
"status": "1"
},
{
"id": "13",
"lang_id": "2",
"medical_type_id": "11",
"name": "Chest pain",
"thumbnail": "thumbnail_images/1579698381.png",
"video": "videos/CHESTPAIN.mp4",
"video_type": "2",
"delete_status": "1",
"user_id": "ok",
"video_id": "13",
"created_at": "2021-03-05 08:17:20",
"status": "1"
},
{
"id": "12",
"lang_id": "2",
"medical_type_id": "10",
"name": "Burns",
"thumbnail": "thumbnail_images/1579698360.png",
"video": "videos/Burns.mp4",
"video_type": "2",
"delete_status": "1",
"user_id": "ok",
"video_id": "12",
"created_at": "2021-03-05 08:16:39",
"status": "1"
},
{
"id": "11",
"lang_id": "2",
"medical_type_id": "9",
"name": "Breathing Difficulties",
"thumbnail": "thumbnail_images/1579698344.png",
"video": "videos/BreathingDifficulties.mp4",
"video_type": "2",
"delete_status": "1",
"user_id": "ok",
"video_id": "11",
"created_at": "2021-03-05 08:16:19",
"status": "1"
},
{
"id": "8",
"lang_id": "2",
"medical_type_id": "6",
"name": "Asthma",
"thumbnail": "thumbnail_images/1579698286.png",
"video": "videos/ASTHMA.mp4",
"video_type": "2",
"delete_status": "1",
"user_id": "ok",
"video_id": "8",
"created_at": "2021-03-05 08:15:59",
"status": "1"
},
{
"id": "24",
"lang_id": "2",
"medical_type_id": "22",
"name": "Fits/Seizures",
"thumbnail": "thumbnail_images/1579698775.png",
"video": "videos/SEIZURES.m4v",
"video_type": "2",
"delete_status": "1",
"user_id": "ok",
"video_id": null,
"created_at": null,
"status": "0"
},
{
"id": "26",
"lang_id": "2",
"medical_type_id": "24",
"name": "Sprain, strain",
"thumbnail": "thumbnail_images/1579698853.png",
"video": "videos/SPRAIN&STRAIN.mp4",
"video_type": "2",
"delete_status": "1",
"user_id": "ok",
"video_id": null,
"created_at": null,
"status": "0"
},
{
"id": "28",
"lang_id": "2",
"medical_type_id": "26",
"name": "Disposing Glove",
"thumbnail": "thumbnail_images/1579698903.png",
"video": "videos/disposingglove.mp4",
"video_type": "1",
"delete_status": "1",
"user_id": "ok",
"video_id": null,
"created_at": null,
"status": "0"
},
{
"id": "31",
"lang_id": "2",
"medical_type_id": "8",
"name": "Bleeding",
"thumbnail": "thumbnail_images/1581498917.png",
"video": "videos/bleeding.mp4",
"video_type": "2",
"delete_status": "1",
"user_id": "ok",
"video_id": null,
"created_at": null,
"status": "0"
},
{
"id": "18",
"lang_id": "2",
"medical_type_id": "16",
"name": "Gunshot Wound",
"thumbnail": "thumbnail_images/1579698550.png",
"video": "videos/Gunshot.mp4",
"video_type": "2",
"delete_status": "1",
"user_id": "ok",
"video_id": null,
"created_at": null,
"status": "0"
},
{
"id": "20",
"lang_id": "2",
"medical_type_id": "18",
"name": "Hypoglycemia",
"thumbnail": "thumbnail_images/1579698684.png",
"video": "videos/Hypoglycemia.mp4",
"video_type": "2",
"delete_status": "1",
"user_id": "ok",
"video_id": null,
"created_at": null,
"status": "0"
},
{
"id": "22",
"lang_id": "2",
"medical_type_id": "20",
"name": "Nose Bleeding",
"thumbnail": "thumbnail_images/1579698728.png",
"video": "videos/nosebleeding.mp4",
"video_type": "2",
"delete_status": "1",
"user_id": "ok",
"video_id": null,
"created_at": null,
"status": "0"
},
{
"id": "25",
"lang_id": "2",
"medical_type_id": "23",
"name": "Snake Bite",
"thumbnail": "thumbnail_images/1579698801.png",
"video": "videos/SnakeBite.mp4",
"video_type": "2",
"delete_status": "1",
"user_id": "ok",
"video_id": null,
"created_at": null,
"status": "0"
},
{
"id": "27",
"lang_id": "2",
"medical_type_id": "25",
"name": "Stroke",
"thumbnail": "thumbnail_images/1579698879.png",
"video": "videos/STROKE.m4v",
"video_type": "2",
"delete_status": "1",
"user_id": "ok",
"video_id": null,
"created_at": null,
"status": "0"
},
{
"id": "29",
"lang_id": "2",
"medical_type_id": "27",
"name": "Dog Bite",
"thumbnail": "thumbnail_images/1579698934.png",
"video": "videos/Dogbite.mp4",
"video_type": "2",
"delete_status": "1",
"user_id": "ok",
"video_id": null,
"created_at": null,
"status": "0"
},
{
"id": "32",
"lang_id": "2",
"medical_type_id": "7",
"name": "Allergy",
"thumbnail": "thumbnail_images/1581580973.png",
"video": "videos/Allergy.mp4",
"video_type": "2",
"delete_status": "1",
"user_id": "ok",
"video_id": null,
"created_at": null,
"status": "0"
},
{
"id": "19",
"lang_id": "2",
"medical_type_id": "17",
"name": "Hyperthermia(Heat Exhaustion)",
"thumbnail": "thumbnail_images/1579698575.png",
"video": "videos/Hyperthermia.mp4",
"video_type": "2",
"delete_status": "1",
"user_id": "ok",
"video_id": null,
"created_at": null,
"status": "0"
},
{
"id": "21",
"lang_id": "2",
"medical_type_id": "19",
"name": "Introduction",
"thumbnail": "thumbnail_images/1579698707.png",
"video": "videos/intro.mp4",
"video_type": "1",
"delete_status": "1",
"user_id": "ok",
"video_id": null,
"created_at": null,
"status": "0"
},
{
"id": "23",
"lang_id": "2",
"medical_type_id": "21",
"name": "Recovery Position",
"thumbnail": "thumbnail_images/1579698747.png",
"video": "videos/RecoveryPosition.mp4",
"video_type": "2",
"delete_status": "1",
"user_id": "ok",
"video_id": null,
"created_at": null,
"status": "0"
}
],
}
Below is my database,
enter image description here
I just want to add both the tables and it will show all the list of videos from first table but if the video is seen by the user, status will show 1 else 1.
I think you want a flag indicating if a user has seen a video. For this, I suggest EXISTS:
select v.*,
(case when exists (select 1
from video_quews vq
where v.id = vq.video_id and vq.user_id = $user_id
)
then 1 else 0
end) as has_user_flag
from videos v

Add Product Variant - 404 Error

I am developing a VB.NET application to interact with our new Shopify store. I am in the process of automating product additions/updates/removal based on data in our Oracle database.
Basically the application creates a new Shopify part for a pattern, then creates product variants for each sku in that pattern. It does this by POSTing and PUTing requests using the HttpWebRequest class. This was working great through yesterday afternoon, now today for some reason it's failing on the product variant creation/update with a 404 - Not Found error code.
The product add request JSON is below. This works perfectly, it creates the part on Shopify which I can then see through the admin panel. This is POSTed to the URL "https://key:password#bath-and-window-direct.myshopify.com/admin/products.json" (where key and password are replaced with our credentials)
{
"product": {
"id": 0,
"body_html": "A classic combination of embroidery and cut work form the flowing border, creating your own seaside retreat. ",
"title": "Seabreeze Sand",
"vendor": "SKL",
"product_type": "",
"published_scope": "global",
"tags": "J71227",
"variants": null,
"options": null,
"images": [{
"id": 0,
"product_id": 0,
"position": 1,
"src": "http:\/\/i320.photobucket.com\/albums\/nn353\/fkhphoto\/J71227main.jpg",
"variant_ids": null
}],
"image": null
}
}
This is the JSON reply I'm receiving after this call, and I can also see the part added in the Shopify admin panel:
{
"product": {
"id": 7874734983,
"title": "Seabreeze Sand",
"body_html": "A classic combination of embroidery and cut work form the flowing border, creating your own seaside retreat. ",
"vendor": "SKL",
"product_type": "",
"created_at": "2016-07-14T10:43:56-04:00",
"handle": "seabreeze-sand",
"updated_at": "2016-07-14T10:43:56-04:00",
"published_at": "2016-07-14T10:43:56-04:00",
"template_suffix": null,
"published_scope": "global",
"tags": "J71227",
"variants": [{
"id": 24925005383,
"product_id": 7874734983,
"title": "Default Title",
"price": "0.00",
"sku": "",
"position": 1,
"grams": 0,
"inventory_policy": "deny",
"compare_at_price": null,
"fulfillment_service": "manual",
"inventory_management": null,
"option1": "Default Title",
"option2": null,
"option3": null,
"created_at": "2016-07-14T10:43:56-04:00",
"updated_at": "2016-07-14T10:43:56-04:00",
"taxable": true,
"barcode": null,
"image_id": null,
"inventory_quantity": 1,
"weight": 0.0,
"weight_unit": "lb",
"old_inventory_quantity": 1,
"requires_shipping": true
}],
"options": [{
"id": 9404426823,
"product_id": 7874734983,
"name": "Title",
"position": 1,
"values": ["Default Title"]
}],
"images": [{
"id": 16242879303,
"product_id": 7874734983,
"position": 1,
"created_at": "2016-07-14T10:43:56-04:00",
"updated_at": "2016-07-14T10:43:56-04:00",
"src": "https://cdn.shopify.com/s/files/1/1363/2407/products/J71227main.jpg?v=1468507436",
"variant_ids": []
}],
"image": {
"id": 16242879303,
"product_id": 7874734983,
"position": 1,
"created_at": "2016-07-14T10:43:56-04:00",
"updated_at": "2016-07-14T10:43:56-04:00",
"src": "https://cdn.shopify.com/s/files/1/1363/2407/products/J71227main.jpg?v=1468507436",
"variant_ids": []
}
}
}
Immediately after that, I'm POSTing the following JSON to add a product variant to this newly created part, to the URL "https://key:password#bath-and-window-direct.myshopify.com/admin/products/7874734983/variants.json". This is the call that returns a 404 - Not Found error through the HttpWebRequest class.
{
"variant": {
"id": 0,
"product_id": 7874734983,
"title": "Seabreeze Tier Curtain in Sand",
"price": "11.99",
"sku": "J7122700013V09",
"compare_at_price": "0.00",
"position": 0,
"grams": 0,
"option1": "57X13 ROD POCKET VAL",
"option2": null,
"option3": null,
"taxable": true,
"barcode": "036326422417",
"weight": 0,
"weight_unit": "lb",
"inventory_quantity": 550,
"old_inventory_quantity": 550,
"requires_shipping": true,
"image_id": null,
"metafields": [{
"id": 0,
"key": "point1",
"value": "57 x 13 Valance",
"value_type": "string",
"namespace": "J7122700013V09"
},
{
"id": 0,
"key": "point2",
"value": "To achieve the look in the photo, use one valance and one tier pair.",
"value_type": "string",
"namespace": "J7122700013V09"
},
{
"id": 0,
"key": "point3",
"value": "Feels like you are in your own beach cottage.",
"value_type": "string",
"namespace": "J7122700013V09"
},
{
"id": 0,
"key": "point4",
"value": "100% Polyester.",
"value_type": "string",
"namespace": "J7122700013V09"
},
{
"id": 0,
"key": "point5",
"value": " ",
"value_type": "string",
"namespace": "J7122700013V09"
}]
}
}
What am I doing wrong? The URLs, when copied into a web browser, work perfectly fine...I can see all the JSON of the current data. But when attempting to add the variant, I'm getting the 404.
Try leaving out the "id": 0 properties — both from the variant and from the metafields. Shopify will determine the IDs automatically.

Stock Quantity of ProductVariant not decreased in shopify shop when placing order via API

I am posting the following Order to the shopify api Order endpoint. The Order shows up in the shop and everything works as it should, except that the stock quantity of the variants in orders placed via the API are not decreased automatically by shopify. When I place an order within the admin console, they are decreased automatically. Shopify inventory tracking is turned on for the products. Any ideas would be greatly appreciated.
{
"order": {
"email": "someName#yahoo.com",
"financial_status": "paid",
"fulfillment_status": null,
"send_receipt": true,
"send_fulfillment_receipt": true,
"note": "Created by someName",
"line_items": [
{
"variant_id": 21718275463,
"quantity": 1,
"price": 99,
"requires_shipping": true,
"product_id": 6820646151
},
{
"variant_id": 21717700871,
"quantity": 1,
"price": 1000,
"requires_shipping": true,
"product_id": 6820646151
},
{
"variant_id": 21717690055,
"quantity": 1,
"price": 555,
"requires_shipping": true,
"product_id": 6821668807
}
],
"processing_method": "offsite",
"shipping_address": {
"first_name": "Chris",
"address1": "111 Love Road",
"phone": "9999999999",
"city": "St. Louis",
"zip": "63123",
"province": "MO",
"country": "United States",
"last_name": "Becker",
"name": "Chris Becker",
"country_code": "US",
"province_code": "MO"
},
"source_name": "someName",
"taxes_included": false,
"shipping_lines": [
{
"title": "standard",
"price": 0.00,
"code": null,
"source": "brand owner on shopify",
"carrier_identifier": null,
"tax_lines": null
}
],
"tags": "someName"
}
}
{
"variant": {
"id": 21718275463,
"product_id": 6820646151,
"title": "m / red",
"price": "99.00",
"sku": "",
"position": 2,
"grams": 0,
"inventory_policy": "deny",
"compare_at_price": "900.00",
"fulfillment_service": "manual",
"inventory_management": "shopify",
"option1": "m",
"option2": "red",
"option3": null,
"created_at": "2016-05-27T13:16:26-04:00",
"updated_at": "2016-05-28T13:28:20-04:00",
"taxable": false,
"barcode": "",
"image_id": 13217378823,
"inventory_quantity": 1,
"weight": 0,
"weight_unit": "lb",
"old_inventory_quantity": 1,
"requires_shipping": true
}
}
{
"variant": {
"id": 21717700871,
"product_id": 6820646151,
"title": "s / green",
"price": "1000.00",
"sku": "",
"position": 1,
"grams": 0,
"inventory_policy": "deny",
"compare_at_price": "1111.00",
"fulfillment_service": "manual",
"inventory_management": "shopify",
"option1": "s",
"option2": "green",
"option3": null,
"created_at": "2016-05-27T13:05:56-04:00",
"updated_at": "2016-05-28T12:17:22-04:00",
"taxable": true,
"barcode": "",
"image_id": 13160712135,
"inventory_quantity": 2,
"weight": 0,
"weight_unit": "lb",
"old_inventory_quantity": 2,
"requires_shipping": true
}
}
{
"variant": {
"id": 21717690055,
"product_id": 6821668807,
"title": "Default Title",
"price": "555.00",
"sku": "",
"position": 1,
"grams": 0,
"inventory_policy": "deny",
"compare_at_price": "666.00",
"fulfillment_service": "manual",
"inventory_management": "shopify",
"option1": "Default Title",
"option2": null,
"option3": null,
"created_at": "2016-05-27T13:05:39-04:00",
"updated_at": "2016-05-28T12:17:22-04:00",
"taxable": true,
"barcode": "",
"image_id": null,
"inventory_quantity": 2,
"weight": 0,
"weight_unit": "lb",
"old_inventory_quantity": 2,
"requires_shipping": true
}
}
You created a fake order using the API. Fake orders like that don't transact money or trigger the usual internal checks and balances without some extra effort. Maybe if you tried adding a fulfillment to the order, Shopify might ding inventory levels? Seems like something to try anyway.