Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

SQL Server Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP

HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
MS Storage Providers
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(SQL Server) WordPress Media Upload

See more WordPress Examples

Demonstrates how to upload a media file to WordPress.

For more information, see https://developer.wordpress.org/rest-api/reference/media/#create-a-media-item

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @iTmp0 int
    -- Important: Do not use nvarchar(max).  See the warning about using nvarchar(max).
    DECLARE @sTmp0 nvarchar(4000)
    -- This example requires the Chilkat API to have been previously unlocked.
    -- See Global Unlock Sample for sample code.

    DECLARE @http int
    -- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    -- This example will use WordPress username / Application password authentication using the "Applications Password" plugin.
    -- See https://wordpress.org/plugins/application-passwords/

    -- Use your WordPress login, such as "admin", not the application name.
    EXEC sp_OASetProperty @http, 'Login', 'wp_username'
    -- Use the application password, such as "Nths RwVH eDJ4 weNZ orMN jabq"
    EXEC sp_OASetProperty @http, 'Password', 'app_password'
    EXEC sp_OASetProperty @http, 'BasicAuth', 1

    DECLARE @req int
    -- Use "Chilkat_9_5_0.HttpRequest" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.HttpRequest', @req OUT

    EXEC sp_OASetProperty @req, 'HttpVerb', 'POST'

    -- Use the Content-Type that corresponds to the type of file you are uploading.

    -- WordPress supports uploading the following file types:

    -- Images
    -- 
    --     .jpg  (image/jpg)
    --     .jpeg  (image/jpeg)
    --     .png  (image/png)
    --     .gif  (image/gif)
    --     .ico (image/x-icon)
    -- 
    -- Documents
    -- 
    --     .pdf (applicatin/pdf)
    --     .doc, .docx (application/msword)
    --     .ppt, .pptx, .pps, .ppsx (application/mspowerpoint)
    --     .odt 
    --     .xls, .xlsx (application/msexcel)
    --     .psd (??? image/vnd.adobe.photoshop,application/x-photoshop,application/photoshop,application/psd,image/psd)
    -- 
    -- Audio
    -- 
    --     .mp3 (audio/mpeg)
    --     .m4a
    --     .ogg
    --     .wav (audio/wav)
    -- 
    -- Video
    -- 
    --     .mp4, .m4v (video/mp4)
    --     .mov (video/quicktime)
    --     .wmv (video/x-ms-wmv)
    --     .avi (video/avi)
    --     .mpg (video/mpeg)
    --     .ogv 
    --     .3gp 
    --     .3g2 

    EXEC sp_OASetProperty @req, 'ContentType', 'image/jpg'
    EXEC sp_OASetProperty @req, 'Path', '/wp-json/wp/v2/media'

    DECLARE @success int
    EXEC sp_OAMethod @req, 'LoadBodyFromFile', @success OUT, 'qa_data/jpg/starfish.jpg'
    IF @success = 0
      BEGIN
        EXEC sp_OAGetProperty @req, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @req
        RETURN
      END
    EXEC sp_OAMethod @req, 'AddHeader', NULL, 'Content-Disposition', 'attachment; filename=starfish.jpg'

    EXEC sp_OAMethod @req, 'AddHeader', NULL, 'Expect', '100-continue'

    DECLARE @resp int
    EXEC sp_OAMethod @http, 'SynchronousRequest', @resp OUT, 'www.yourserver.com', 443, 1, @req
    EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
    IF @iTmp0 <> 1
      BEGIN
        EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @req
        RETURN
      END


    EXEC sp_OAGetProperty @resp, 'StatusCode', @iTmp0 OUT
    PRINT 'HTTP response status: ' + @iTmp0

    DECLARE @jsonResponse int
    -- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @jsonResponse OUT

    EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT
    EXEC sp_OAMethod @jsonResponse, 'Load', @success OUT, @sTmp0
    EXEC @hr = sp_OADestroy @resp

    EXEC sp_OASetProperty @jsonResponse, 'EmitCompact', 0
    EXEC sp_OAMethod @jsonResponse, 'Emit', @sTmp0 OUT
    PRINT @sTmp0

    -- Sample JSON response:
    -- (Sample code for parsing the JSON response is shown below)

    -- {
    --   "id": 1915,
    --   "date": "2021-01-19T18:25:01",
    --   "date_gmt": "2021-01-20T01:25:01",
    --   "guid": {
    --     "rendered": "http:\/\/cknotes.com\/wp-content\/uploads\/2021\/01\/starfish.jpg",
    --     "raw": "http:\/\/cknotes.com\/wp-content\/uploads\/2021\/01\/starfish.jpg"
    --   },
    --   "modified": "2021-01-19T18:25:01",
    --   "modified_gmt": "2021-01-20T01:25:01",
    --   "slug": "starfish",
    --   "status": "inherit",
    --   "type": "attachment",
    --   "link": "https:\/\/cknotes.com\/starfish\/",
    --   "title": {
    --     "raw": "starfish",
    --     "rendered": "starfish"
    --   },
    --   "author": 1,
    --   "comment_status": "closed",
    --   "ping_status": "closed",
    --   "template": "",
    --   "meta": [
    --   ],
    --   "permalink_template": "https:\/\/cknotes.com\/?attachment_id=1915",
    --   "generated_slug": "starfish",
    --   "description": {
    --     "raw": "",
    --     "rendered": "<p class=\"attachment\"><a href='https:\/\/cknotes.com\/wp-content\/uploads\/2021\/01\/starfish.jpg'><img width=\"120\" height=\"120\" src=\"https:\/\/cknotes.com\/wp-content\/uploads\/2021\/01\/starfish.jpg\" class=\"attachment-medium size-medium\" alt=\"\" loading=\"lazy\" srcset=\"http:\/\/cknotes.com\/wp-content\/uploads\/2021\/01\/starfish.jpg 120w, http:\/\/cknotes.com\/wp-content\/uploads\/2021\/01\/starfish-100x100.jpg 100w\" sizes=\"(max-width: 120px) 100vw, 120px\" \/><\/a><\/p>\n"
    --   },
    --   "caption": {
    --     "raw": "",
    --     "rendered": ""
    --   },
    --   "alt_text": "",
    --   "media_type": "image",
    --   "mime_type": "image\/jpeg",
    --   "media_details": {
    --     "width": 120,
    --     "height": 120,
    --     "file": "2021\/01\/starfish.jpg",
    --     "sizes": {
    --       "woocommerce_gallery_thumbnail": {
    --         "file": "starfish-100x100.jpg",
    --         "width": 100,
    --         "height": 100,
    --         "mime_type": "image\/jpeg",
    --         "source_url": "https:\/\/cknotes.com\/wp-content\/uploads\/2021\/01\/starfish-100x100.jpg"
    --       },
    --       "shop_thumbnail": {
    --         "file": "starfish-100x100.jpg",
    --         "width": 100,
    --         "height": 100,
    --         "mime_type": "image\/jpeg",
    --         "source_url": "https:\/\/cknotes.com\/wp-content\/uploads\/2021\/01\/starfish-100x100.jpg"
    --       },
    --       "full": {
    --         "file": "starfish.jpg",
    --         "width": 120,
    --         "height": 120,
    --         "mime_type": "image\/jpeg",
    --         "source_url": "https:\/\/cknotes.com\/wp-content\/uploads\/2021\/01\/starfish.jpg"
    --       }
    --     },
    --     "image_meta": {
    --       "aperture": "0",
    --       "credit": "",
    --       "camera": "",
    --       "caption": "",
    --       "created_timestamp": "0",
    --       "copyright": "",
    --       "focal_length": "0",
    --       "iso": "0",
    --       "shutter_speed": "0",
    --       "title": "",
    --       "orientation": "0",
    --       "keywords": [
    --       ]
    --     }
    --   },
    --   "post": null,
    --   "source_url": "https:\/\/cknotes.com\/wp-content\/uploads\/2021\/01\/starfish.jpg",
    --   "missing_image_sizes": [
    --   ],
    --   "_links": {
    --     "self": [
    --       {
    --         "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/media\/1915"
    --       }
    --     ],
    --     "collection": [
    --       {
    --         "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/media"
    --       }
    --     ],
    --     "about": [
    --       {
    --         "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/types\/attachment"
    --       }
    --     ],
    --     "author": [
    --       {
    --         "embeddable": true,
    --         "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/users\/1"
    --       }
    --     ],
    --     "replies": [
    --       {
    --         "embeddable": true,
    --         "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/comments?post=1915"
    --       }
    --     ],
    --     "wp:action-unfiltered-html": [
    --       {
    --         "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/media\/1915"
    --       }
    --     ],
    --     "wp:action-assign-author": [
    --       {
    --         "href": "https:\/\/cknotes.com\/wp-json\/wp\/v2\/media\/1915"
    --       }
    --     ],
    --     "curies": [
    --       {
    --         "name": "wp",
    --         "href": "https:\/\/api.w.org\/{rel}",
    --         "templated": true
    --       }
    --     ]
    --   }
    -- }

    -- Sample code for parsing the JSON response...
    -- Use the following online tool to generate parsing code from sample JSON:
    -- Generate Parsing Code from JSON

    DECLARE @date_gmt int
    -- Use "Chilkat_9_5_0.DtObj" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.DtObj', @date_gmt OUT

    DECLARE @href nvarchar(4000)

    DECLARE @embeddable int

    DECLARE @name nvarchar(4000)

    DECLARE @templated int

    DECLARE @id int
    EXEC sp_OAMethod @jsonResponse, 'IntOf', @id OUT, 'id'
    DECLARE @date nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @date OUT, 'date'
    EXEC sp_OAMethod @jsonResponse, 'DtOf', @success OUT, 'date_gmt', 0, @date_gmt
    DECLARE @guidRendered nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @guidRendered OUT, 'guid.rendered'
    DECLARE @guidRaw nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @guidRaw OUT, 'guid.raw'
    DECLARE @modified nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @modified OUT, 'modified'
    DECLARE @modified_gmt nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @modified_gmt OUT, 'modified_gmt'
    DECLARE @slug nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @slug OUT, 'slug'
    DECLARE @status nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @status OUT, 'status'
    DECLARE @v_type nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @v_type OUT, 'type'
    DECLARE @link nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @link OUT, 'link'
    DECLARE @titleRaw nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @titleRaw OUT, 'title.raw'
    DECLARE @titleRendered nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @titleRendered OUT, 'title.rendered'
    DECLARE @author int
    EXEC sp_OAMethod @jsonResponse, 'IntOf', @author OUT, 'author'
    DECLARE @comment_status nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @comment_status OUT, 'comment_status'
    DECLARE @ping_status nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @ping_status OUT, 'ping_status'
    DECLARE @template nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @template OUT, 'template'
    DECLARE @permalink_template nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @permalink_template OUT, 'permalink_template'
    DECLARE @generated_slug nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @generated_slug OUT, 'generated_slug'
    DECLARE @descriptionRaw nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @descriptionRaw OUT, 'description.raw'
    DECLARE @descriptionRendered nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @descriptionRendered OUT, 'description.rendered'
    DECLARE @captionRaw nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @captionRaw OUT, 'caption.raw'
    DECLARE @captionRendered nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @captionRendered OUT, 'caption.rendered'
    DECLARE @alt_text nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @alt_text OUT, 'alt_text'
    DECLARE @media_type nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @media_type OUT, 'media_type'
    DECLARE @mime_type nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @mime_type OUT, 'mime_type'
    DECLARE @media_detailsWidth int
    EXEC sp_OAMethod @jsonResponse, 'IntOf', @media_detailsWidth OUT, 'media_details.width'
    DECLARE @media_detailsHeight int
    EXEC sp_OAMethod @jsonResponse, 'IntOf', @media_detailsHeight OUT, 'media_details.height'
    DECLARE @media_detailsFile nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @media_detailsFile OUT, 'media_details.file'
    DECLARE @media_detailsSizesWoocommerce_gallery_thumbnailFile nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @media_detailsSizesWoocommerce_gallery_thumbnailFile OUT, 'media_details.sizes.woocommerce_gallery_thumbnail.file'
    DECLARE @media_detailsSizesWoocommerce_gallery_thumbnailWidth int
    EXEC sp_OAMethod @jsonResponse, 'IntOf', @media_detailsSizesWoocommerce_gallery_thumbnailWidth OUT, 'media_details.sizes.woocommerce_gallery_thumbnail.width'
    DECLARE @media_detailsSizesWoocommerce_gallery_thumbnailHeight int
    EXEC sp_OAMethod @jsonResponse, 'IntOf', @media_detailsSizesWoocommerce_gallery_thumbnailHeight OUT, 'media_details.sizes.woocommerce_gallery_thumbnail.height'
    DECLARE @media_detailsSizesWoocommerce_gallery_thumbnailMime_type nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @media_detailsSizesWoocommerce_gallery_thumbnailMime_type OUT, 'media_details.sizes.woocommerce_gallery_thumbnail.mime_type'
    DECLARE @media_detailsSizesWoocommerce_gallery_thumbnailSource_url nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @media_detailsSizesWoocommerce_gallery_thumbnailSource_url OUT, 'media_details.sizes.woocommerce_gallery_thumbnail.source_url'
    DECLARE @media_detailsSizesShop_thumbnailFile nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @media_detailsSizesShop_thumbnailFile OUT, 'media_details.sizes.shop_thumbnail.file'
    DECLARE @media_detailsSizesShop_thumbnailWidth int
    EXEC sp_OAMethod @jsonResponse, 'IntOf', @media_detailsSizesShop_thumbnailWidth OUT, 'media_details.sizes.shop_thumbnail.width'
    DECLARE @media_detailsSizesShop_thumbnailHeight int
    EXEC sp_OAMethod @jsonResponse, 'IntOf', @media_detailsSizesShop_thumbnailHeight OUT, 'media_details.sizes.shop_thumbnail.height'
    DECLARE @media_detailsSizesShop_thumbnailMime_type nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @media_detailsSizesShop_thumbnailMime_type OUT, 'media_details.sizes.shop_thumbnail.mime_type'
    DECLARE @media_detailsSizesShop_thumbnailSource_url nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @media_detailsSizesShop_thumbnailSource_url OUT, 'media_details.sizes.shop_thumbnail.source_url'
    DECLARE @media_detailsSizesFullFile nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @media_detailsSizesFullFile OUT, 'media_details.sizes.full.file'
    DECLARE @media_detailsSizesFullWidth int
    EXEC sp_OAMethod @jsonResponse, 'IntOf', @media_detailsSizesFullWidth OUT, 'media_details.sizes.full.width'
    DECLARE @media_detailsSizesFullHeight int
    EXEC sp_OAMethod @jsonResponse, 'IntOf', @media_detailsSizesFullHeight OUT, 'media_details.sizes.full.height'
    DECLARE @media_detailsSizesFullMime_type nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @media_detailsSizesFullMime_type OUT, 'media_details.sizes.full.mime_type'
    DECLARE @media_detailsSizesFullSource_url nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @media_detailsSizesFullSource_url OUT, 'media_details.sizes.full.source_url'
    DECLARE @media_detailsImage_metaAperture nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @media_detailsImage_metaAperture OUT, 'media_details.image_meta.aperture'
    DECLARE @media_detailsImage_metaCredit nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @media_detailsImage_metaCredit OUT, 'media_details.image_meta.credit'
    DECLARE @media_detailsImage_metaCamera nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @media_detailsImage_metaCamera OUT, 'media_details.image_meta.camera'
    DECLARE @media_detailsImage_metaCaption nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @media_detailsImage_metaCaption OUT, 'media_details.image_meta.caption'
    DECLARE @media_detailsImage_metaCreated_timestamp nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @media_detailsImage_metaCreated_timestamp OUT, 'media_details.image_meta.created_timestamp'
    DECLARE @media_detailsImage_metaCopyright nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @media_detailsImage_metaCopyright OUT, 'media_details.image_meta.copyright'
    DECLARE @media_detailsImage_metaFocal_length nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @media_detailsImage_metaFocal_length OUT, 'media_details.image_meta.focal_length'
    DECLARE @media_detailsImage_metaIso nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @media_detailsImage_metaIso OUT, 'media_details.image_meta.iso'
    DECLARE @media_detailsImage_metaShutter_speed nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @media_detailsImage_metaShutter_speed OUT, 'media_details.image_meta.shutter_speed'
    DECLARE @media_detailsImage_metaTitle nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @media_detailsImage_metaTitle OUT, 'media_details.image_meta.title'
    DECLARE @media_detailsImage_metaOrientation nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @media_detailsImage_metaOrientation OUT, 'media_details.image_meta.orientation'
    DECLARE @post nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @post OUT, 'post'
    DECLARE @source_url nvarchar(4000)
    EXEC sp_OAMethod @jsonResponse, 'StringOf', @source_url OUT, 'source_url'
    DECLARE @i int
    SELECT @i = 0
    DECLARE @count_i int
    EXEC sp_OAMethod @jsonResponse, 'SizeOfArray', @count_i OUT, 'meta'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jsonResponse, 'I', @i
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jsonResponse, 'SizeOfArray', @count_i OUT, 'media_details.image_meta.keywords'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jsonResponse, 'I', @i
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jsonResponse, 'SizeOfArray', @count_i OUT, 'missing_image_sizes'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jsonResponse, 'I', @i
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jsonResponse, 'SizeOfArray', @count_i OUT, '_links.self'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jsonResponse, 'I', @i
        EXEC sp_OAMethod @jsonResponse, 'StringOf', @href OUT, '_links.self[i].href'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jsonResponse, 'SizeOfArray', @count_i OUT, '_links.collection'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jsonResponse, 'I', @i
        EXEC sp_OAMethod @jsonResponse, 'StringOf', @href OUT, '_links.collection[i].href'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jsonResponse, 'SizeOfArray', @count_i OUT, '_links.about'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jsonResponse, 'I', @i
        EXEC sp_OAMethod @jsonResponse, 'StringOf', @href OUT, '_links.about[i].href'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jsonResponse, 'SizeOfArray', @count_i OUT, '_links.author'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jsonResponse, 'I', @i
        EXEC sp_OAMethod @jsonResponse, 'BoolOf', @embeddable OUT, '_links.author[i].embeddable'
        EXEC sp_OAMethod @jsonResponse, 'StringOf', @href OUT, '_links.author[i].href'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jsonResponse, 'SizeOfArray', @count_i OUT, '_links.replies'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jsonResponse, 'I', @i
        EXEC sp_OAMethod @jsonResponse, 'BoolOf', @embeddable OUT, '_links.replies[i].embeddable'
        EXEC sp_OAMethod @jsonResponse, 'StringOf', @href OUT, '_links.replies[i].href'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jsonResponse, 'SizeOfArray', @count_i OUT, '_links.wp:action-unfiltered-html'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jsonResponse, 'I', @i
        EXEC sp_OAMethod @jsonResponse, 'StringOf', @href OUT, '_links.wp:action-unfiltered-html[i].href'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jsonResponse, 'SizeOfArray', @count_i OUT, '_links.wp:action-assign-author'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jsonResponse, 'I', @i
        EXEC sp_OAMethod @jsonResponse, 'StringOf', @href OUT, '_links.wp:action-assign-author[i].href'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jsonResponse, 'SizeOfArray', @count_i OUT, '_links.curies'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jsonResponse, 'I', @i
        EXEC sp_OAMethod @jsonResponse, 'StringOf', @name OUT, '_links.curies[i].name'
        EXEC sp_OAMethod @jsonResponse, 'StringOf', @href OUT, '_links.curies[i].href'
        EXEC sp_OAMethod @jsonResponse, 'BoolOf', @templated OUT, '_links.curies[i].templated'
        SELECT @i = @i + 1
      END

    EXEC @hr = sp_OADestroy @http
    EXEC @hr = sp_OADestroy @req
    EXEC @hr = sp_OADestroy @jsonResponse
    EXEC @hr = sp_OADestroy @date_gmt


END
GO

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.