The required field 'image_url' was not supplied - bigcommerce

I am using big commerce API v3 https://api.bigcommerce.com/stores/xxxxxxxxxx/v3/ (catalog/products) to create a new product.
I want to pull this image from WEBDAV and I have uploaded this product as product_images/import/product-1.jpg in WEBDAV.
The input data is in POST like,
{
"categories": [
1,
2
],
"name": "My Product",
"sku": "MP1",
"type": "physical",
"depth": 0,
"price": 5,
"sale_price": 3,
"images": [
{
"image_file": "product-1.jpg"
}
],
"description": "My first product description"
},
but it is returned 400: The required field 'image_url' was not supplied.
It is working with full URL using image_url but not working with image_file.

Thank you for bringing this to our attention. The docs are going to be updated to clearly display the expected behavior and use of this endpoint.
The endpoint requires the "image_url" path, which you do not have by only uploading the file with webdav. So, after you upload the image to webdav, you will have to add the store url prior to the image path. Like "image_url": "https://store-domain.com/product-1.jpg"

Related

How can I add product to shopify store from another website?

I want add products to Shopify store form another website (maybe) using API. I not finding the request URL for do it. Please help me make it. I Writing this website with PHP (Laravel framework)
To create new product you can use the Product REST API
Example:
POST /admin/api/2020-07/products.json
{
"product": {
"title": "Burton Custom Freestyle 151",
"body_html": "<strong>Good snowboard!</strong>",
"vendor": "Burton",
"product_type": "Snowboard",
"metafields": [
{
"key": "new",
"value": "newvalue",
"value_type": "string",
"namespace": "global"
}
]
}
}
Pay attention that for such type operation you will need to have the write_products scope

How to Get Twitch Video Thumbnail URL?

Video-sharing websites such as Youtube has a endpoint for video thumbnails
Example: http://img.youtube.com/vi/youtube_id/default.jpg
where youtube_id = the id of the video
So I can just do
<img src="http://img.youtube.com/vi/youtube_id/default.jpg">
with no problem
Does twitch have something like this as well?
Update 2018
Twitch requires you to use its API so you can get access to video thumbnails. Apparently, this is because the URL of the thumbnails may change
Here is a simple guide how to get access to a twitch video thumbnail
You have to get access to Twitch dev API - to do this you need to register an account at https://glass.twitch.tv
After registering an account you must then create an App from your twitch dev dashboard
After creating the App, you will be given a Client ID to be used for that app - note that the app is the one which will be using the twitch API (for example, your website)
You can now pass the client_id as a query string parameter to https://api.twitch.tv/kraken/videos/106400740?client_id=xxxxxxx where 106400740 is the video id (note that 'kraken' here is constant - not sure of the origin behind its name) - note that the request will return a JSON object which contains an error message if you do not include a client_id
The request will return a JSON object which looks something like:
{
"title": "Door 5 vs Tilted Gamers",
"description": "COOL Games: Killing Spree first match # Mineski. Grove, Los Ba\u00f1os",
"description_html": "COOL Games: Killing Spree first match # Mineski. Grove, Los Ba\u00f1os<br>",
"broadcast_id": 1,
"broadcast_type": "upload",
"status": "recorded",
"language": "en",
"tag_list": "",
"views": 4,
"created_at": "2017-11-08T03:13:12Z",
"published_at": "2017-11-08T04:33:37Z",
"url": "https:\/\/www.twitch.tv\/videos\/188543310",
"_id": "v188543310",
"recorded_at": "2017-11-08T03:13:12Z",
"game": "Dota 2",
"length": 2436,
"preview": "https:\/\/static-cdn.jtvnw.net\/s3_vods\/esportsdotcool\/188543310\/3534ab8c-bf7d-4c8a-b502-c406825bf75f\/thumb\/index-0000000000-320x240.jpg",
"animated_preview_url": "https:\/\/vod-storyboards.twitch.tv\/esportsdotcool\/188543310\/3534ab8c-bf7d-4c8a-b502-c406825bf75f\/storyboards\/188543310-strip-0.jpg",
"thumbnails": [
{
"type": "generated",
"url": "https:\/\/static-cdn.jtvnw.net\/s3_vods\/esportsdotcool\/188543310\/3534ab8c-bf7d-4c8a-b502-c406825bf75f\/thumb\/index-0000000000-320x240.jpg"
},
{
"type": "generated",
"url": "https:\/\/static-cdn.jtvnw.net\/s3_vods\/esportsdotcool\/188543310\/3534ab8c-bf7d-4c8a-b502-c406825bf75f\/thumb\/index-0000000006-320x240.jpg"
},
{
"type": "generated",
"url": "https:\/\/static-cdn.jtvnw.net\/s3_vods\/esportsdotcool\/188543310\/3534ab8c-bf7d-4c8a-b502-c406825bf75f\/thumb\/index-0000000012-320x240.jpg"
},
{
"type": "generated",
"url": "https:\/\/static-cdn.jtvnw.net\/s3_vods\/esportsdotcool\/188543310\/3534ab8c-bf7d-4c8a-b502-c406825bf75f\/thumb\/index-0000000018-320x240.jpg"
}
],
"fps": {
"144p30": 29.999544341896,
"360p30": 29.999544341896,
"480p30": 29.999544341896
},
"resolutions": {
"144p30": "256x144",
"360p30": "640x360",
"480p30": "852x480"
},
"channel": {
"name": "esportsdotcool",
"display_name": "esportsdotcool"
},
"_links": {
"self": "https:\/\/api.twitch.tv\/kraken\/videos\/v188543310",
"channel": "https:\/\/api.twitch.tv\/kraken\/channels\/esportsdotcool"
}
}
Under the thumbnails array you can find the url to the video.
PS: As you can see, the thumbnails array has length of 4 - at this point I think this is because of the different sizes of the image that the author of the video can put up

How do I create an event using the SocialTables API?

I'm trying to use the /4.0/legacyvm3/teams/{team}/events endpoint to create an event. I'm running into some trouble with spaces.
I used the /4.0/legacyvm3/teams/{team}/venues endpoint to get a list of venues. I chose one to include in the spaces section and posted this:
{
"name": "Event via API Test 04",
"category": "athletic event",
"public": true,
"attendee_management": true,
"start_time": "2017-04-05T16:13:54.217Z",
"end_time": "2017-04-05T16:13:54.217Z",
"uses_metric": false,
"venue_mapper_version": 0,
"spaces": [
{
"venue_id": 128379,
"name": "Snurrrggggg"
}
]
}
The endpoint returns a 400 code and this error:
{
"code": 400,
"message": "Cannot read property 'toLowerCase' of undefined"
}
I tried including the wizard section, but each time it would return this error:
{
"message": "Access Denied to this feature"
}
After some experimentation, this body succeeded:
{
"name": "Event via API Test 03",
"category": "athletic event",
"public": true,
"attendee_management": true,
"start_time": "2017-04-05T16:13:54.217Z",
"end_time": "2017-04-05T16:13:54.217Z",
"uses_metric": false,
"venue_mapper_version": 0,
"spaces": [
{
"name": "Fake News Room"
}
]
}
But the application itself would not display the diagram, and the newly created room did not show up in my list of venues. Perhaps it did not assign permissions to it?
In any case, I don't actually want to create a new venue/space. I want to pass in an existing venue/space. How do I do that?
The short answer is to create a working diagram in 4.0 you will need to POST some data to the /4.0/diagrams endpoint.
The room you create doesn't map to the same concept as venues. When you create an event as you did, it creates a new space entity. The spaces endpoints can return information on those.

How to get revision history of a file using OneDrive for business API

I am integrating OneDrive for business (REST API) with our Platform. I can upload a file and update the files contents using the upload API. But how do I get the revision history of a file. The API which I am using is listed below.
Upload a file
You can't use OneDrive for business API to get file revisions (versions), but you can use SharePoint API to get them.
Use this link to get file versions:
GET
"https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/_api/web/GetFileByServerRelativeUrl(#v)/Versions?#v='/personal/email_tenant_onmicrosoft_com/Documents/TEST_005.xlsx'"
where:
"email_tenant_onmicrosoft_com" - is email of your drive
"tenant-my.sharepoint.com" - EndPoint of your drive
Response of this link looks like this JSON:
{
"odata.metadata": "https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/_api/$metadata#SP.ApiData.FileVersions",
"value": [
{
"odata.type": "SP.FileVersion",
"odata.id": "https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/_api/SP.FileVersionf1111111-aaaa-1234-5678-90abcdef1234",
"odata.editLink": "SP.FileVersionf1111111-aaaa-1234-5678-90abcdef1234",
"CheckInComment": "",
"Created": "2013-04-27T15:57:57Z",
"ID": 512,
"IsCurrentVersion": false,
"Length": "5716",
"Size": 5716,
"Url": "_vti_history/512/Documents/TEST_005.xlsx",
"VersionLabel": "1.0"
},
{
"odata.type": "SP.FileVersion",
"odata.id": "https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/_api/SP.FileVersion2ab46e3e-9614-43ff-ad03-252b1f4d0d90",
"odata.editLink": "SP.FileVersion2ab46e3e-9614-43ff-ad03-252b1f4d0d90",
"CheckInComment": "",
"Created": "2013-04-27T15:58:39Z",
"ID": 1024,
"IsCurrentVersion": false,
"Length": "7868",
"Size": 7868,
"Url": "_vti_history/1024/Documents/TEST_005.xlsx",
"VersionLabel": "2.0"
},
{
"odata.type": "SP.FileVersion",
"odata.id": "https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/_api/SP.FileVersion42f5f367-05ca-4131-84bf-79e7a6c0f77d",
"odata.editLink": "SP.FileVersion42f5f367-05ca-4131-84bf-79e7a6c0f77d",
"CheckInComment": "",
"Created": "2013-04-27T15:58:43Z",
"ID": 1536,
"IsCurrentVersion": false,
"Length": "7868",
"Size": 7868,
"Url": "_vti_history/1536/Documents/TEST_005.xlsx",
"VersionLabel": "3.0"
}
]
}
important parameters for you is:
"odata.editLink" after "SP.FileVersion" - it's unique Id of file version.
"ID" - it's version id of current file.
To download file version you can use this link:
"https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/_api/web/GetFileByServerRelativeUrl(#v)/Versions(1024)/$value?#v='/personal/email_tenant_onmicrosoft_com/Documents/TEST_005.xlsx'"
where "1024" - field "ID" from JSON.
To get info about last version of item you can use this link:
GET
"https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/_api/web/GetFileByServerRelativeUrl(#v)?#v='/personal/email_tenant_onmicrosoft_com/Documents/TEST_005.xlsx'"
Response of this link looks like this JSON:
{
"odata.metadata": "https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/_api/$metadata#SP.ApiData.Files12/#Element",
"odata.type": "SP.File",
"odata.id": "https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/_api/Web/GetFileByServerRelativeUrl('/personal/email_tenant_onmicrosoft_com/Documents/TEST_005.xlsx')",
"odata.editLink": "Web/GetFileByServerRelativeUrl('/personal/email_tenant_onmicrosoft_com/Documents/TEST_005.xlsx')",
"CheckInComment": "",
"CheckOutType": 2,
"ContentTag": "{C4B73433-8AED-44C2-862A-746EBA4599EB},11,7",
"CustomizedPageStatus": 0,
"ETag": "\"{C4B73433-8AED-44C2-862A-746EBA4599EB},11\"",
"Exists": true,
"IrmEnabled": false,
"Length": "7923",
"Level": 1,
"LinkingUri": "https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/Documents/TEST_005.xlsx?d=wc4b734338aed44c2862a746eba4599eb",
"LinkingUrl": "https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/Documents/TEST_005.xlsx?d=wc4b734338aed44c2862a746eba4599eb",
"MajorVersion": 4,
"MinorVersion": 0,
"Name": "TEST_005.xlsx",
"ServerRelativeUrl": "/personal/email_tenant_onmicrosoft_com/Documents/TEST_005.xlsx",
"TimeCreated": "2013-04-27T15:57:55Z",
"TimeLastModified": "2013-04-27T15:59:28Z",
"Title": null,
"UIVersion": 2048,
"UIVersionLabel": "4.0",
"UniqueId": "c4b73433-8aed-44c2-862a-746eba4599eb"
}
you can use this info, when you add a new revision of file.
"UniqueId" - it's right part of "odata.editLink" in versions JSON.
"UIVersion" - it's "ID" in version JSON.
To download last version of file - use this link:
"https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/_api/web/GetFileByServerRelativeUrl(#v)/$value?#v='/personal/email_tenant_onmicrosoft_com/Documents/TEST_005.xlsx'"
link:
"https://tenant-my.sharepoint.com/personal/email_tenant_onmicrosoft_com/_api/web/GetFileByServerRelativeUrl(#v)/Versions(2048)/$value?#v='/personal/email_tenant_onmicrosoft_com/Documents/TEST_005.xlsx'"
doesn't work. It will work if you add a new version of this file.
You can download last revision of item by using OneDrive API link:
"https://tenant-my.sharepoint.com/_api/v2.0/drives/driveId/items/driveItemId/content"
but this link doesn't work if you use Service Account authentication
Till date there is no api resource for getting version or revision history of a file. Follow the link to know about available operations on items in one drive for business.

BigCommerce API - What is correct resource for updating an option value

I'm trying to update an option value using the BigCommerce api.
The documentation says PUT /options/values/id.json
The console says PUT options/id/values.json
I think it should be PUT options/id/values/id.json, which returns a 200 response code, but does not execute the update.
Any information on what the right endpoint is for this and if it works?
Basically, if you do a GET request on options
{
"id": 3,
"name": "Colors",
"display_name": "Color",
"type": "CS",
"values": {
"url": "https://store-xxx.mybigcommerce.com/api/v2/options/3/values.json",
"resource": "/options/3/values"
}
}
The resource endpoint shows that the URL is options/id/values.json. But, this gives you all the values associated with the option. If you want to retrieve a specific option the endpoint is something similar to /api/v2/options/3/values/7.json
{
"id": 7,
"option_id": 3,
"label": "Silver",
"sort_order": 1,
"value": "#cccccc"
}
Doing a PUT request on this - (On REST console, setting the header content-type to application/json and sending raw JSON data) updates the label - Changed Silver to silver)
{
"id": 7,
"option_id": 3,
"label": "silver",
"sort_order": 1,
"value": "#cccccc"
}