Google Drive

Google Drive has been integrated into the shop service to utilize existing media content for product images and not need to upload all product images.

OAuth Scopes Required

To utilize the ability to access images and videos to attach to Product Variants, the following OAuth scopes are required for Yordadev API to function properly.

  • drive

  • drive.file

These are to be able to go in and grab existing photo's to be selected from to attach to a Product Variant.

https://yorgate.yordadev.network/v1/oauth/gdrive
This endpoint allows you to get an OAuth link to authorize a Google Drive for media.
Request
Response
Request
Headers
Authorization
required
string
Your Personal Access Token
Query Parameters
shop_id
required
string
The shop_id to which you wish to attach google drive
Response
201: Created
OAuth link successfully created.
[
"status" => 200
"payload" => array:1 [
"OAuth_URL" => "<linkremoved>"
]
"meta" => array:2 [
"from" => "127.0.0.1"
"agent" => "Symfony"
]
]

Yorspace Root Folder Information

During the OAuth Process, after we have established access tokens we create a root folder. Utilizing the Google Drive Dashboard you can copy whatever you want into it and all the content will be accessible through the Fetch Media Library.

The Root Folder that is created is named "Yorspace Root". If you remove this folder or change the name, the Yorgate Service will create it again for you. This is logged and will be deemed as malicious after rand(2,4) times.

A media_id is the field fileID on the Google Drive Platform.

To obtain a media_id, there are two ways to go about this. You can do it through Google Drive's Dashboard to get the desired contents media_id, more about that here or you can utilize the Fetch Media Library endpoint as shown here.

Attaching Media to Products

For detailed information on this see:

get
Fetching the Google Drive Library

https://yorgate.yordadev.network/v1/gdrive/library
This endpoint returns the id, name, mime type, and the web URL of the items within Yorspace Root.
Request
Response
Request
Headers
Authorization
required
string
Your Shop's Client Credential Token
Query Parameters
q
optional
string
Query string for refining search through media library.
Response
200: OK
{
"status": 200,
"payload": {
{
"media_id": "1lXw3cxQhPyKJv3akH758YJqAEBjSb2Bb",
"name": "ayee.jpg",
"mimeType": "image/jpeg",
"webView": "https://drive.google.com/thumbnail?id=1lXw3cxQhPyKJv3akH758YJqAEBjSb2Bb"
},
{
"media_id": "1-bUwpVaP6YqeZnXuKS8KjpSZPY-hhwTO",
"name": "Folder name",
"mimeType": "Folder",
"children": [
{
"media_id": "1cJzQTWnWFa4vHgKeTqrcSs4RTXNYJhvx",
"name": "Stickers",
"mimeType": "Folder",
"children": [
{
"media_id": "13VaF6X9Q-RQe0kWXZHkVMhz_uxMziPyD",
"name": "sticker_friend.jpg",
"mimeType": "image/jpeg",
"webView": "https://drive.google.com/thumbnail?id=13VaF6X9Q-RQe0kWXZHkVMhz_uxMziPyD"
}
]
},
{
"media_id": "1Ibsqgl3S3wrYDBmKTE0nOxh6eHkZtwUW",
"name": "elon.jpg",
"mimeType": "image/jpeg",
"webView": "https://drive.google.com/thumbnail?id=1Ibsqgl3S3wrYDBmKTE0nOxh6eHkZtwUW"
}
]
}
},
"meta": {
"from": "127.0.0.1",
"agent": "PostmanRuntime/7.22.0"
}
}