├── .gitignore ├── LICENSE.txt ├── README.md ├── docs ├── using-joomla-framework │ ├── add-joomla-articles-from-streamed-csv-url │ │ └── README.md │ ├── edit-joomla-articles-from-streamed-csv-url │ │ └── README.md │ ├── smart-add-edit-random-defined-sites-github-graphql │ │ └── README.md │ ├── smart-add-edit-to-multiple-sites-airtable-api │ │ └── README.md │ ├── smart-add-edit-to-multiple-sites-from-csv-url │ │ └── README.md │ ├── smart-add-edit-with-subform-custom-field-support-from-streamed-csv-url │ │ └── README.md │ ├── smart-add-or-edit-joomla-articles-from-streamed-csv-url │ │ └── README.md │ └── turn-your-top-5-favorite-movies-into-joomla-articles-omdb-api │ │ └── README.md └── using-raw-php │ ├── add-joomla-articles-from-streamed-csv-url │ └── README.md │ ├── edit-joomla-articles-from-streamed-csv-url │ └── README.md │ ├── smart-add-edit-random-defined-sites-github-graphql │ └── README.md │ ├── smart-add-edit-to-multiple-sites-airtable-api │ └── README.md │ ├── smart-add-edit-to-multiple-sites-from-csv-url │ └── README.md │ ├── smart-add-edit-with-subform-custom-field-support-from-streamed-csv-url │ └── README.md │ ├── smart-add-or-edit-joomla-articles-from-streamed-csv-url │ └── README.md │ └── turn-your-top-5-favorite-movies-into-joomla-articles-omdb-api │ └── README.md ├── media ├── data │ └── sample-data.csv └── images │ ├── screenshot-joomla-webservices-airtable-api-mashup.png │ ├── screenshot-joomla-webservices-from-streamed-csv-url.png │ ├── screenshot-joomla-webservices-github-graphql-api-mashup.png │ └── screenshot-joomla-webservices-omdb-movie-api-mashup.png ├── using-joomla-framework └── .gitkeep └── using-raw-php ├── add-joomla-articles-from-streamed-csv-url.php ├── edit-joomla-articles-from-streamed-csv-url.php ├── smart-add-edit-random-defined-sites-github-graphql.php ├── smart-add-edit-to-multiple-sites-airtable-api.php ├── smart-add-edit-to-multiple-sites-from-csv-url.php ├── smart-add-edit-with-subform-custom-field-support-from-streamed-csv-url.php ├── smart-add-or-edit-joomla-articles-from-streamed-csv-url.php └── turn-your-top-5-favorite-movies-into-joomla-articles-omdb-api.php /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | 3 | ### NotepadPP template 4 | # Notepad++ backups # 5 | *.bak 6 | 7 | ### VisualStudioCode template 8 | .vscode/* 9 | !.vscode/settings.json 10 | !.vscode/tasks.json 11 | !.vscode/launch.json 12 | !.vscode/extensions.json 13 | !.vscode/*.code-snippets 14 | 15 | # Local History for Visual Studio Code 16 | .history/ 17 | 18 | # Built Visual Studio Code Extensions 19 | *.vsix 20 | 21 | ### NetBeans template 22 | **/nbproject/private/ 23 | **/nbproject/Makefile-*.mk 24 | **/nbproject/Package-*.bash 25 | build/ 26 | nbbuild/ 27 | dist/ 28 | nbdist/ 29 | .nb-gradle/ 30 | 31 | ### JetBrains template 32 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider 33 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 34 | 35 | # User-specific stuff 36 | .idea/ 37 | 38 | # File-based project format 39 | *.iws 40 | 41 | # IntelliJ 42 | out/ 43 | 44 | # mpeltonen/sbt-idea plugin 45 | .idea_modules/ 46 | 47 | # JIRA plugin 48 | atlassian-ide-plugin.xml 49 | 50 | # Crashlytics plugin (for Android Studio and IntelliJ) 51 | com_crashlytics_export_strings.xml 52 | crashlytics.properties 53 | crashlytics-build.properties 54 | fabric.properties 55 | 56 | ### Linux template 57 | *~ 58 | 59 | # temporary files which can be created if a process still has a handle open of a deleted file 60 | .fuse_hidden* 61 | 62 | # KDE directory preferences 63 | .directory 64 | 65 | # Linux trash folder which might appear on any partition or disk 66 | .Trash-* 67 | 68 | # .nfs files are created when an open file is removed but is still being accessed 69 | .nfs* 70 | 71 | ### Emacs template 72 | # -*- mode: gitignore; -*- 73 | \#*\# 74 | /.emacs.desktop 75 | /.emacs.desktop.lock 76 | *.elc 77 | auto-save-list 78 | tramp 79 | .\#* 80 | 81 | # Org-mode 82 | .org-id-locations 83 | *_archive 84 | 85 | # flymake-mode 86 | *_flymake.* 87 | 88 | # eshell files 89 | /eshell/history 90 | /eshell/lastdir 91 | 92 | # elpa packages 93 | /elpa/ 94 | 95 | # reftex files 96 | *.rel 97 | 98 | # AUCTeX auto folder 99 | /auto/ 100 | 101 | # cask packages 102 | .cask/ 103 | 104 | # Flycheck 105 | flycheck_*.el 106 | 107 | # server auth directory 108 | /server/ 109 | 110 | # projectiles files 111 | .projectile 112 | 113 | # directory configuration 114 | .dir-locals.el 115 | 116 | # network security 117 | /network-security.data 118 | 119 | 120 | ### Eclipse template 121 | .metadata 122 | bin/ 123 | tmp/ 124 | *.tmp 125 | *.swp 126 | *~.nib 127 | local.properties 128 | .settings/ 129 | .loadpath 130 | .recommenders 131 | 132 | # External tool builders 133 | .externalToolBuilders/ 134 | 135 | # Locally stored "Eclipse launch configurations" 136 | *.launch 137 | 138 | # PyDev specific (Python IDE for Eclipse) 139 | *.pydevproject 140 | 141 | # CDT-specific (C/C++ Development Tooling) 142 | .cproject 143 | 144 | # CDT- autotools 145 | .autotools 146 | 147 | # Java annotation processor (APT) 148 | .factorypath 149 | 150 | # PDT-specific (PHP Development Tools) 151 | .buildpath 152 | 153 | # sbteclipse plugin 154 | .target 155 | 156 | # Tern plugin 157 | .tern-project 158 | 159 | # TeXlipse plugin 160 | .texlipse 161 | 162 | # STS (Spring Tool Suite) 163 | .springBeans 164 | 165 | # Code Recommenders 166 | .recommenders/ 167 | 168 | # Annotation Processing 169 | .apt_generated/ 170 | .apt_generated_test/ 171 | 172 | # Scala IDE specific (Scala & Java development for Eclipse) 173 | .cache-main 174 | .scala_dependencies 175 | .worksheet 176 | 177 | # Uncomment this line if you wish to ignore the project description file. 178 | # Typically, this file would be tracked if it contains build/dependency configurations: 179 | #.project 180 | 181 | ### Windows template 182 | # Windows thumbnail cache files 183 | Thumbs.db 184 | Thumbs.db:encryptable 185 | ehthumbs.db 186 | ehthumbs_vista.db 187 | 188 | # Dump file 189 | *.stackdump 190 | 191 | # Folder config file 192 | [Dd]esktop.ini 193 | 194 | # Recycle Bin used on file shares 195 | $RECYCLE.BIN/ 196 | 197 | # Windows Installer files 198 | *.cab 199 | *.msi 200 | *.msix 201 | *.msm 202 | *.msp 203 | 204 | # Windows shortcuts 205 | *.lnk 206 | 207 | ### Vim template 208 | # Swap 209 | [._]*.s[a-v][a-z] 210 | !*.svg # comment out if you don't need vector files 211 | [._]*.sw[a-p] 212 | [._]s[a-rt-v][a-z] 213 | [._]ss[a-gi-z] 214 | [._]sw[a-p] 215 | 216 | # Session 217 | Session.vim 218 | Sessionx.vim 219 | 220 | # Temporary 221 | .netrwhist 222 | # Auto-generated tag files 223 | tags 224 | # Persistent undo 225 | [._]*.un~ 226 | 227 | ### macOS template 228 | # General 229 | .DS_Store 230 | .AppleDouble 231 | .LSOverride 232 | 233 | # Icon must end with two \r 234 | Icon 235 | 236 | # Thumbnails 237 | ._* 238 | 239 | # Files that might appear in the root of a volume 240 | .DocumentRevisions-V100 241 | .fseventsd 242 | .Spotlight-V100 243 | .TemporaryItems 244 | .Trashes 245 | .VolumeIcon.icns 246 | .com.apple.timemachine.donotpresent 247 | 248 | # Directories potentially created on remote AFP share 249 | .AppleDB 250 | .AppleDesktop 251 | Network Trash Folder 252 | Temporary Items 253 | .apdisk 254 | 255 | ### SublimeText template 256 | # Cache files for Sublime Text 257 | *.tmlanguage.cache 258 | *.tmPreferences.cache 259 | *.stTheme.cache 260 | 261 | # Workspace files are user-specific 262 | *.sublime-workspace 263 | 264 | # Project files should be checked into the repository, unless a significant 265 | # proportion of contributors will probably not be using Sublime Text 266 | # *.sublime-project 267 | 268 | # SFTP configuration file 269 | sftp-config.json 270 | sftp-config-alt*.json 271 | 272 | # Package control specific files 273 | Package Control.last-run 274 | Package Control.ca-list 275 | Package Control.ca-bundle 276 | Package Control.system-ca-bundle 277 | Package Control.cache/ 278 | Package Control.ca-certs/ 279 | Package Control.merged-ca-bundle 280 | Package Control.user-ca-bundle 281 | oscrypto-ca-bundle.crt 282 | bh_unicode_properties.cache 283 | 284 | # Sublime-github package stores a github token in this file 285 | # https://packagecontrol.io/packages/sublime-github 286 | GitHub.sublime-settings 287 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published by 637 | the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # j4x-api-examples 2 | 3 | ## WHY? 4 | If you are a Joomla! developer or want to become a Joomla! developer there is a new resource for you 5 | [The Official New Joomla! Manual](https://github.com/joomla/Manual.git) 6 | 7 | If you are eager to learn more about Joomla! Web Services and want to play around with them using, ready to use, short examples, sample code and experiments this repo is for you. 8 | The examples are intentionally short with comments and for common scenarios and use cases. So even a non-developer could follow along. 9 | 10 | ## DOCUMENTATION 11 | 12 | ### USING RAW PHP 13 | 14 | * [How to Add Joomla Articles From Streamed CSV URL using Joomla Web Services](docs/using-raw-php/add-joomla-articles-from-streamed-csv-url/README.md) 15 | 16 | * [How to Edit Joomla Articles From Streamed CSV URL using Joomla Web Services](docs/using-raw-php/edit-joomla-articles-from-streamed-csv-url/README.md) 17 | 18 | * [How to Add / Edit Joomla Articles From GitHub GraphQL using Joomla Web Services](docs/using-raw-php/smart-add-edit-random-defined-sites-github-graphql/README.md) 19 | 20 | * [How to Add / Edit Joomla Articles From Airtable using Joomla Web Services](docs/using-raw-php/smart-add-edit-to-multiple-sites-airtable-api/README.md) 21 | 22 | * [How to Add / Edit Joomla Articles To Multiples Sites using Joomla Web Services](docs/using-raw-php/smart-add-edit-to-multiple-sites-from-csv-url/README.md) 23 | 24 | * [How to Add / Edit Joomla Articles With Subforms To Multiples Sites using Joomla Web Services](docs/using-raw-php/smart-add-edit-with-subform-custom-field-support-from-streamed-csv-url/README.md) 25 | 26 | * [How to Smart Add / Edit Joomla Articles From CSV URL using Joomla Web Services](docs/using-raw-php/smart-add-or-edit-joomla-articles-from-streamed-csv-url/README.md) 27 | 28 | * [How to Turn Your Top 5 Favorite Movie Into Joomla Articles using Joomla Web Services](docs/using-raw-php/turn-your-top-5-favorite-movies-into-joomla-articles-omdb-api/README.md) 29 | 30 | ### USING JOOMLA FRAMEWORK 31 | 32 | * [How to Add Joomla Articles From Streamed CSV URL using Joomla Web Services](docs/using-joomla-framework/add-joomla-articles-from-streamed-csv-url/README.md) 33 | 34 | * [How to Edit Joomla Articles From Streamed CSV URL using Joomla Web Services](docs/using-joomla-framework/edit-joomla-articles-from-streamed-csv-url/README.md) 35 | 36 | * [How to Add / Edit Joomla Articles From GitHub GraphQL using Joomla Web Services](docs/using-joomla-framework/smart-add-edit-random-defined-sites-github-graphql/README.md) 37 | 38 | * [How to Add / Edit Joomla Articles From Airtable using Joomla Web Services](docs/using-joomla-framework/smart-add-edit-to-multiple-sites-airtable-api/README.md) 39 | 40 | * [How to Add / Edit Joomla Articles To Multiples Sites using Joomla Web Services](docs/using-joomla-framework/smart-add-edit-to-multiple-sites-from-csv-url/README.md) 41 | 42 | * [How to Add / Edit Joomla Articles With Subforms To Multiples Sites using Joomla Web Services](docs/using-joomla-framework/smart-add-edit-with-subform-custom-field-support-from-streamed-csv-url/README.md) 43 | 44 | * [How to Smart Add / Edit Joomla Articles From CSV URL using Joomla Web Services](docs/using-joomla-framework/smart-add-or-edit-joomla-articles-from-streamed-csv-url/README.md) 45 | 46 | * [How to Turn Your Top 5 Favorite Movie Into Joomla Articles using Joomla Web Services](docs/using-joomla-framework/turn-your-top-5-favorite-movies-into-joomla-articles-omdb-api/README.md) 47 | 48 | ## PRESENTATION 49 | [Marc Dechèvre slides presenting Joomla! Api examples](https://slides.woluweb.be/api/api.html) 50 | 51 | 52 | ## SPECIAL THANKS 53 | - Peter MARTIN (@pe7er) for ignition of showcasing the Joomla Api at JoomlaDay D-A-C-H event 54 | - Marc DECHÈVRE (@woluweb) a.k.a. Custom King for some ideas that led me to create this repo. 55 | - Tim DAVIS (@basicjoomla) for hosting the live video on his popular YouTube Channel about Joomla : BasicJoomla 56 | 57 | 58 | ## VIDEO 59 | 60 | This presentation was made at 61 | - BasicJoomla 2022.11.23 [video - English](https://www.youtube.com/watch?v=ZH3a4MHB718) 62 | - JoomlaDay NL 2023.05.13 [video - English](https://www.youtube.com/watch?v=bhGYCWFdaRw) 63 | - JoomlaDay FR 2023.06.17 [video - French](https://www.youtube.com/watch?v=3wS8bgFpfYg) 64 | - JUG London 2023.06.20 [video - English](https://www.youtube.com/watch?v=TfGr80O3UeA) 65 | - JoomlaDay D-A-CH 2023.09.16 [video - English](https://www.youtube.com/watch?v=WeI6wIUxGbM) 66 | -------------------------------------------------------------------------------- /docs/using-joomla-framework/add-joomla-articles-from-streamed-csv-url/README.md: -------------------------------------------------------------------------------- 1 | # Add Joomla Articles From Streamed CSV URL using Joomla Framework 2 | 3 | > Not Implemented Yet ;-) 4 | -------------------------------------------------------------------------------- /docs/using-joomla-framework/edit-joomla-articles-from-streamed-csv-url/README.md: -------------------------------------------------------------------------------- 1 | # Edit Joomla Articles From Streamed CSV URL using Joomla Framework 2 | 3 | > Not Implemented Yet ;-) 4 | -------------------------------------------------------------------------------- /docs/using-joomla-framework/smart-add-edit-random-defined-sites-github-graphql/README.md: -------------------------------------------------------------------------------- 1 | # Smart Add / Edit random defined sites GitHub GraphQL using Joomla Framework 2 | 3 | > Not Implemented Yet ;-) 4 | -------------------------------------------------------------------------------- /docs/using-joomla-framework/smart-add-edit-to-multiple-sites-airtable-api/README.md: -------------------------------------------------------------------------------- 1 | # Smart Add / Edit multiples sites Airtable using Joomla Framework 2 | 3 | > Not Implemented Yet ;-) 4 | -------------------------------------------------------------------------------- /docs/using-joomla-framework/smart-add-edit-to-multiple-sites-from-csv-url/README.md: -------------------------------------------------------------------------------- 1 | # Smart Add / Edit Joomla Articles to multiple sites from CSV url using Joomla Framework 2 | 3 | > Not Implemented Yet ;-) 4 | -------------------------------------------------------------------------------- /docs/using-joomla-framework/smart-add-edit-with-subform-custom-field-support-from-streamed-csv-url/README.md: -------------------------------------------------------------------------------- 1 | # Smart Add / Edit Joomla Articles with Subform Field Support from CSV url using Joomla Framework 2 | 3 | > Not Implemented Yet ;-) 4 | -------------------------------------------------------------------------------- /docs/using-joomla-framework/smart-add-or-edit-joomla-articles-from-streamed-csv-url/README.md: -------------------------------------------------------------------------------- 1 | # Smart Add / Edit Joomla Articles from streamed CSV url using Joomla Framework 2 | 3 | > Not Implemented Yet ;-) 4 | -------------------------------------------------------------------------------- /docs/using-joomla-framework/turn-your-top-5-favorite-movies-into-joomla-articles-omdb-api/README.md: -------------------------------------------------------------------------------- 1 | # Turn your Top 5 Favorite Movies Into Joomla Articles 2 | 3 | > Not Implemented Yet ;-) 4 | -------------------------------------------------------------------------------- /docs/using-raw-php/add-joomla-articles-from-streamed-csv-url/README.md: -------------------------------------------------------------------------------- 1 | # Add Joomla Articles From Streamed CSV URL using RAW PHP 2 | 3 | ## SCREENSHOT 4 | 5 | ![Screenshot for Joomla Web Services from Streamed Csv url](../../../media/images/screenshot-joomla-webservices-from-streamed-csv-url.png) 6 | 7 | 8 | ## SOURCE 9 | 10 | [Click here to view source code](../../../using-raw-php/add-joomla-articles-from-streamed-csv-url.php) 11 | -------------------------------------------------------------------------------- /docs/using-raw-php/edit-joomla-articles-from-streamed-csv-url/README.md: -------------------------------------------------------------------------------- 1 | # Edit Joomla Articles From Streamed CSV URL using RAW PHP 2 | 3 | ## SCREENSHOT 4 | 5 | ![Screenshot for Joomla Web Services from Streamed Csv url](../../../media/images/screenshot-joomla-webservices-from-streamed-csv-url.png) 6 | 7 | ## SOURCE 8 | 9 | [Click here to view source code](../../../using-raw-php/edit-joomla-articles-from-streamed-csv-url.php) 10 | -------------------------------------------------------------------------------- /docs/using-raw-php/smart-add-edit-random-defined-sites-github-graphql/README.md: -------------------------------------------------------------------------------- 1 | # Smart Add / Edit random defined sites GitHub GraphQL using RAW PHP 2 | 3 | ## SCREENSHOT 4 | 5 | ![Screenshot for Smart Add / Edit random defined sites GitHub GraphQL](../../../media/images/screenshot-joomla-webservices-github-graphql-api-mashup.png) 6 | 7 | ## SOURCE 8 | 9 | [Click here to view source code](../../../using-raw-php/smart-add-edit-random-defined-sites-github-graphql.php) 10 | -------------------------------------------------------------------------------- /docs/using-raw-php/smart-add-edit-to-multiple-sites-airtable-api/README.md: -------------------------------------------------------------------------------- 1 | # Smart Add / Edit multiples sites Airtable using RAW PHP 2 | 3 | ## SCREENSHOT 4 | 5 | ![Screenshot for Smart Add / Edit multiples sites Airtable using RAW PHP](../../../media/images/screenshot-joomla-webservices-airtable-api-mashup.png) 6 | 7 | ## SOURCE 8 | 9 | [Click here to view source code](../../../using-raw-php/smart-add-edit-to-multiple-sites-airtable-api.php) 10 | -------------------------------------------------------------------------------- /docs/using-raw-php/smart-add-edit-to-multiple-sites-from-csv-url/README.md: -------------------------------------------------------------------------------- 1 | # Smart Add / Edit Joomla Articles to multiple sites from CSV url using RAW PHP 2 | 3 | ## SCREENSHOT 4 | 5 | ![Screenshot for Smart Add / Edit Joomla Articles to multiple sites from CSV url using RAW PHP 6 | ](../../../media/images/screenshot-joomla-webservices-from-streamed-csv-url.png) 7 | 8 | ## SOURCE 9 | 10 | [Click here to view source code](../../../using-raw-php/smart-add-edit-to-multiple-sites-from-csv-url.php) 11 | -------------------------------------------------------------------------------- /docs/using-raw-php/smart-add-edit-with-subform-custom-field-support-from-streamed-csv-url/README.md: -------------------------------------------------------------------------------- 1 | # Smart Add / Edit Joomla Articles with Subform Field Support from CSV url using RAW PHP 2 | 3 | ## SCREENSHOT 4 | 5 | ![Screenshot for Smart Add / Edit with Subform Field Support from CSV url using RAW PHP 6 | ](../../../media/images/screenshot-joomla-webservices-from-streamed-csv-url.png) 7 | 8 | ## SOURCE 9 | 10 | [Click here to view source code](../../../using-raw-php/smart-add-edit-with-subform-custom-field-support-from-streamed-csv-url.php) 11 | -------------------------------------------------------------------------------- /docs/using-raw-php/smart-add-or-edit-joomla-articles-from-streamed-csv-url/README.md: -------------------------------------------------------------------------------- 1 | # Smart Add / Edit Joomla Articles from streamed CSV url RAW PHP 2 | 3 | ## SCREENSHOT 4 | 5 | ![Screenshot for Smart Add / Edit Joomla Articles from streamed CSV url RAW PHP 6 | ](../../../media/images/screenshot-joomla-webservices-from-streamed-csv-url.png) 7 | 8 | ## SOURCE 9 | 10 | [Click here to view source code](../../../using-raw-php/smart-add-or-edit-joomla-articles-from-streamed-csv-url.php) 11 | -------------------------------------------------------------------------------- /docs/using-raw-php/turn-your-top-5-favorite-movies-into-joomla-articles-omdb-api/README.md: -------------------------------------------------------------------------------- 1 | # Turn your Top 5 Favorite Movies Into Joomla Articles 2 | 3 | > Using OMDb API and Joomla Web Services / API 4 | 5 | 6 | 7 | * Add or Edit Joomla! Articles Via API To Multiple Sites Chosen Randomly in from a predefined list Using OMDb API 8 | * 9 | - When id = 0 it's doing a POST. If alias exists it add a random slug at the end of your alias and do POST again 10 | * 11 | - When id > 0 it's doing a PATCH. If alias exists it add a random slug at the end of your alias and do PATCH again 12 | 13 | [Click here to view source code](../../../using-raw-php/turn-your-top-5-favorite-movies-into-joomla-articles-omdb-api.php) 14 | -------------------------------------------------------------------------------- /media/data/sample-data.csv: -------------------------------------------------------------------------------- 1 | "id","tokenindex","access","title","alias","alias-seed","catid","articletext","introtext","fulltext","language","metadesc","metakey","state","featured","seed","article-subform-field","images","urls" 2 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 2","line-2","line-",2,"Sample article text 2","Sample intro text 2",,"*",,,1,0,2,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 3 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 3","line-3","line-",2,"Sample article text 3","Sample intro text 3",,"*",,,1,0,3,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 4 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 4","line-4","line-",2,"Sample article text 4","Sample intro text 4",,"*",,,1,0,4,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 5 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 5","line-5","line-",2,"Sample article text 5","Sample intro text 5",,"*",,,1,0,5,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 6 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 6","line-6","line-",2,"Sample article text 6","Sample intro text 6",,"*",,,1,0,6,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 7 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 7","line-7","line-",2,"Sample article text 7","Sample intro text 7",,"*",,,1,0,7,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 8 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 8","line-8","line-",2,"Sample article text 8","Sample intro text 8",,"*",,,1,0,8,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 9 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 9","line-9","line-",2,"Sample article text 9","Sample intro text 9",,"*",,,1,0,9,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 10 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 10","line-10","line-",2,"Sample article text 10","Sample intro text 10",,"*",,,1,0,10,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 11 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 11","line-11","line-",2,"Sample article text 11","Sample intro text 11",,"*",,,1,0,11,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 12 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 12","line-12","line-",2,"Sample article text 12","Sample intro text 12",,"*",,,1,0,12,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 13 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 13","line-13","line-",2,"Sample article text 13","Sample intro text 13",,"*",,,1,0,13,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 14 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 14","line-14","line-",2,"Sample article text 14","Sample intro text 14",,"*",,,1,0,14,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 15 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 15","line-15","line-",2,"Sample article text 15","Sample intro text 15",,"*",,,1,0,15,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 16 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 16","line-16","line-",2,"Sample article text 16","Sample intro text 16",,"*",,,1,0,16,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 17 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 17","line-17","line-",2,"Sample article text 17","Sample intro text 17",,"*",,,1,0,17,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 18 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 18","line-18","line-",2,"Sample article text 18","Sample intro text 18",,"*",,,1,0,18,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 19 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 19","line-19","line-",2,"Sample article text 19","Sample intro text 19",,"*",,,1,0,19,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 20 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 20","line-20","line-",2,"Sample article text 20","Sample intro text 20",,"*",,,1,0,20,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 21 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 21","line-21","line-",2,"Sample article text 21","Sample intro text 21",,"*",,,1,0,21,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 22 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 22","line-22","line-",2,"Sample article text 22","Sample intro text 22",,"*",,,1,0,22,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 23 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 23","line-23","line-",2,"Sample article text 23","Sample intro text 23",,"*",,,1,0,23,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 24 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 24","line-24","line-",2,"Sample article text 24","Sample intro text 24",,"*",,,1,0,24,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 25 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 25","line-25","line-",2,"Sample article text 25","Sample intro text 25",,"*",,,1,0,25,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 26 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 26","line-26","line-",2,"Sample article text 26","Sample intro text 26",,"*",,,1,0,26,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 27 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 27","line-27","line-",2,"Sample article text 27","Sample intro text 27",,"*",,,1,0,27,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 28 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 28","line-28","line-",2,"Sample article text 28","Sample intro text 28",,"*",,,1,0,28,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 29 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 29","line-29","line-",2,"Sample article text 29","Sample intro text 29",,"*",,,1,0,29,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 30 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 30","line-30","line-",2,"Sample article text 30","Sample intro text 30",,"*",,,1,0,30,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 31 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 31","line-31","line-",2,"Sample article text 31","Sample intro text 31",,"*",,,1,0,31,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 32 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 32","line-32","line-",2,"Sample article text 32","Sample intro text 32",,"*",,,1,0,32,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 33 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 33","line-33","line-",2,"Sample article text 33","Sample intro text 33",,"*",,,1,0,33,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 34 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 34","line-34","line-",2,"Sample article text 34","Sample intro text 34",,"*",,,1,0,34,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 35 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 35","line-35","line-",2,"Sample article text 35","Sample intro text 35",,"*",,,1,0,35,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 36 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 36","line-36","line-",2,"Sample article text 36","Sample intro text 36",,"*",,,1,0,36,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 37 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 37","line-37","line-",2,"Sample article text 37","Sample intro text 37",,"*",,,1,0,37,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 38 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 38","line-38","line-",2,"Sample article text 38","Sample intro text 38",,"*",,,1,0,38,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 39 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 39","line-39","line-",2,"Sample article text 39","Sample intro text 39",,"*",,,1,0,39,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 40 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 40","line-40","line-",2,"Sample article text 40","Sample intro text 40",,"*",,,1,0,40,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 41 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 41","line-41","line-",2,"Sample article text 41","Sample intro text 41",,"*",,,1,0,41,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 42 | 0,"app-001",1,"Datasource - Offline csv file – Sample Data : Line 42","line-42","line-",2,"Sample article text 42","Sample intro text 42",,"*",,,1,0,42,"{""row0"":{""field2"":1410,""field1"":""This an article summary 1 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here...Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row1"":{""field2"":1410,""field1"":""This an article summary 2 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}, ""row2"":{""field2"":1410,""field1"":""This an article summary 3 for this dessert. Short & Sweet!"", ""field7"": ""What's up Super Joomlers! Alex here... Proud to be a joomler. Nowadays focusing on Joomla! 4.x Web Services Apis.""}}","{""image_intro"": ""https://example.org/sample-intro-image.jpg"", ""image_intro_caption"": ""sample intro image caption"", ""image_intro_alt"":""sample intro image alt text"", ""float_intro"":"""",""image_fulltext"": ""https://example.org/sample-full-image.jpg"", ""image_fulltext_caption"": ""sample full image caption"", ""image_fulltext_alt"":""sample full image alt text"", ""float_fulltext"":""""}","{""urla"":""https://apiadept.com"",""urlatext"":""Website"",""targeta"":"""",""urlb"":""https://github.com/alexandreelise"",""urlbtext"":""Github"",""targetb"":"""",""urlc"":""https://twitter.com/mralexandrelise"",""urlctext"":""Twitter"",""targetc"":""""}" 43 | -------------------------------------------------------------------------------- /media/images/screenshot-joomla-webservices-airtable-api-mashup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexandreelise/j4x-api-examples/c7b8cb5b5a3a724b9d6c747e61365d783fb2bdd0/media/images/screenshot-joomla-webservices-airtable-api-mashup.png -------------------------------------------------------------------------------- /media/images/screenshot-joomla-webservices-from-streamed-csv-url.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexandreelise/j4x-api-examples/c7b8cb5b5a3a724b9d6c747e61365d783fb2bdd0/media/images/screenshot-joomla-webservices-from-streamed-csv-url.png -------------------------------------------------------------------------------- /media/images/screenshot-joomla-webservices-github-graphql-api-mashup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexandreelise/j4x-api-examples/c7b8cb5b5a3a724b9d6c747e61365d783fb2bdd0/media/images/screenshot-joomla-webservices-github-graphql-api-mashup.png -------------------------------------------------------------------------------- /media/images/screenshot-joomla-webservices-omdb-movie-api-mashup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexandreelise/j4x-api-examples/c7b8cb5b5a3a724b9d6c747e61365d783fb2bdd0/media/images/screenshot-joomla-webservices-omdb-movie-api-mashup.png -------------------------------------------------------------------------------- /using-joomla-framework/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexandreelise/j4x-api-examples/c7b8cb5b5a3a724b9d6c747e61365d783fb2bdd0/using-joomla-framework/.gitkeep -------------------------------------------------------------------------------- /using-raw-php/add-joomla-articles-from-streamed-csv-url.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright (c) 2009 - present. Alexandre ELISÉ. All rights reserved. 9 | * @license GNU Affero General Public License version 3 (AGPLv3) 10 | * @link https://apiadept.com 11 | */ 12 | 13 | // Public url of the sample csv used in this example (CHANGE WITH YOUR OWN CSV URL IF YOU WISH) 14 | $csvUrl = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vTtV7Bnj-E3mwnBgXbkZlzS476aHVp6vtZ7qdI5vxlPUUqNe_85S3ozT5_gzNkBDih4dL1f8uDeeh_g/pub?gid=522567559&single=true&output=csv'; 15 | 16 | // HTTP Verb 17 | $httpVerb = 'POST'; 18 | 19 | // Your Joomla! 4.x website base url 20 | $baseUrl = 'https://example.org'; 21 | $basePath = 'api/index.php/v1'; 22 | 23 | // This time we need endpoint to be a function to make it more dynamic 24 | $endpoint = fn(string $givenBaseUrl, string $givenBasePath, int $givenResourceId = 0): string => $givenResourceId ? sprintf('%s/%s/%s/%d', $givenBaseUrl, $givenBasePath, 'content/articles', $givenResourceId) 25 | : sprintf('%s/%s/%s', $givenBaseUrl, $givenBasePath, 'content/articles'); 26 | $timeout = 10; 27 | 28 | // Add custom fields support (shout-out to Marc DECHÈVRE : CUSTOM KING) 29 | // The keys are the columns in the csv with the custom fields names (that's how Joomla! Web Services Api work as of today) 30 | // For the custom fields to work they need to be added in the csv and to exists in the Joomla! site. 31 | $customFieldKeys = []; //['with-coffee','with-dessert','extra-water-bottle']; 32 | 33 | // Your Joomla! 4.x Api Token (DO NOT STORE IT IN YOUR REPO USE A VAULT OR A PASSWORD MANAGER) 34 | $token = ''; 35 | 36 | // PHP Generator to efficiently read the csv file 37 | $generator = function (string $url, array $keys = []): Generator { 38 | 39 | if (empty($url)) 40 | { 41 | yield new RuntimeException('Url MUST NOT be empty', 422); 42 | } 43 | 44 | $defaultKeys = [ 45 | 'title', 46 | 'alias', 47 | 'catid', 48 | 'articletext', 49 | 'language', 50 | 'metadesc', 51 | 'metakey', 52 | 'state', 53 | 'featured', 54 | ]; 55 | 56 | $mergedKeys = array_unique(array_merge($defaultKeys, $keys)); 57 | 58 | $resource = fopen($url, 'r'); 59 | 60 | if ($resource === false) 61 | { 62 | yield new RuntimeException('Could not read csv file', 500); 63 | } 64 | 65 | try 66 | { 67 | //NON-BLOCKING I/O (Does not wait before processing next line.) 68 | stream_set_blocking($resource, false); 69 | 70 | do 71 | { 72 | $currentLine = stream_get_line( 73 | $resource, 74 | 0, 75 | "\r\n" 76 | ); 77 | 78 | if (empty($currentLine)) 79 | { 80 | yield new RuntimeException('Current line MUST NOT be empty', 422); 81 | } 82 | 83 | $extractedContent = str_getcsv($currentLine); 84 | 85 | // Remove first element of csv line as it is usually the id of the article (since for POST it's not used, we remove it) 86 | array_shift($extractedContent); 87 | 88 | if ($mergedKeys != $extractedContent) 89 | { 90 | $encodedContent = json_encode(array_combine($mergedKeys, $extractedContent)); 91 | 92 | yield $encodedContent; 93 | } 94 | yield new RuntimeException('Current line seem to be invalid', 422); 95 | } while (!feof($resource)); 96 | } finally 97 | { 98 | fclose($resource); 99 | } 100 | }; 101 | 102 | // Read CSV in a PHP Generator using streams in non-blocking I/O mode 103 | $streamCsv = $generator($csvUrl, $customFieldKeys); 104 | 105 | // Process data returned by the PHP Generator 106 | $process = function (string $givenHttpVerb, string $endpoint, string $dataString, array $headers, int $timeout, $transport) { 107 | curl_setopt_array($transport, [ 108 | CURLOPT_URL => $endpoint, 109 | CURLOPT_RETURNTRANSFER => true, 110 | CURLOPT_ENCODING => 'utf-8', 111 | CURLOPT_MAXREDIRS => 10, 112 | CURLOPT_TIMEOUT => $timeout, 113 | CURLOPT_FOLLOWLOCATION => true, 114 | CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_2TLS, 115 | CURLOPT_CUSTOMREQUEST => $givenHttpVerb, 116 | CURLOPT_POSTFIELDS => $dataString, 117 | CURLOPT_HTTPHEADER => $headers, 118 | ] 119 | ); 120 | 121 | $response = curl_exec($transport); 122 | // Might slow down the script but at least shows what's going on 123 | echo $response . PHP_EOL; 124 | return $response; 125 | }; 126 | 127 | foreach ($streamCsv as $dataString) 128 | { 129 | if (!is_string($dataString)) 130 | { 131 | continue; 132 | } 133 | $curl = curl_init(); 134 | try 135 | { 136 | // HTTP request headers 137 | $headers = [ 138 | 'Accept: application/vnd.api+json', 139 | 'Content-Type: application/json', 140 | 'Content-Length: ' . mb_strlen($dataString), 141 | sprintf('X-Joomla-Token: %s', trim($token)), 142 | ]; 143 | 144 | $output = $process($httpVerb, $endpoint($baseUrl, $basePath, 0), $dataString, $headers, $timeout, $curl); 145 | // Continue even on partial failure 146 | if (empty($output) || array_key_exists('errors', json_decode($output, true))) 147 | { 148 | continue; 149 | } 150 | } 151 | catch (Throwable $e) 152 | { 153 | echo $e->getMessage() . PHP_EOL; 154 | continue; 155 | } finally 156 | { 157 | curl_close($curl); 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /using-raw-php/edit-joomla-articles-from-streamed-csv-url.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright (c) 2009 - present. Alexandre ELISÉ. All rights reserved. 9 | * @license GNU Affero General Public License version 3 (AGPLv3) 10 | * @link https://apiadept.com 11 | */ 12 | 13 | // Public url of the sample csv used in this example (CHANGE WITH YOUR OWN CSV URL IF YOU WISH) 14 | $csvUrl = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vTtV7Bnj-E3mwnBgXbkZlzS476aHVp6vtZ7qdI5vxlPUUqNe_85S3ozT5_gzNkBDih4dL1f8uDeeh_g/pub?gid=522567559&single=true&output=csv'; 15 | 16 | // HTTP Verb 17 | $httpVerb = 'PATCH'; 18 | 19 | // Your Joomla! 4.x website base url 20 | $baseUrl = 'https://example.org'; 21 | $basePath = 'api/index.php/v1'; 22 | 23 | // This time we need endpoint to be a function to make it more dynamic 24 | $endpoint = fn(string $givenBaseUrl, string $givenBasePath, int $givenResourceId = 0): string => $givenResourceId ? sprintf('%s/%s/%s/%d', $givenBaseUrl, $givenBasePath, 'content/articles', $givenResourceId) 25 | : sprintf('%s/%s/%s', $givenBaseUrl, $givenBasePath, 'content/articles'); 26 | 27 | $timeout = 10; 28 | 29 | // Add custom fields support (shout-out to Marc DECHÈVRE : CUSTOM KING) 30 | // The keys are the columns in the csv with the custom fields names (that's how Joomla! Web Services Api work as of today) 31 | // For the custom fields to work they need to be added in the csv and to exists in the Joomla! site. 32 | $customFieldKeys = []; //['with-coffee','with-dessert','extra-water-bottle']; 33 | 34 | // Your Joomla! 4.x Api Token (DO NOT STORE IT IN YOUR REPO USE A VAULT OR A PASSWORD MANAGER) 35 | $token = ''; 36 | 37 | // PHP Generator to efficiently read the csv file 38 | $generator = function (string $url, array $keys = []): Generator { 39 | 40 | if (empty($url)) 41 | { 42 | yield new RuntimeException('Url MUST NOT be empty', 422); 43 | } 44 | 45 | $defaultKeys = [ 46 | 'id', 47 | 'title', 48 | 'alias', 49 | 'catid', 50 | 'articletext', //does not work when using PATCH 51 | 'introtext', 52 | 'fulltext', 53 | 'language', 54 | 'metadesc', 55 | 'metakey', 56 | 'state', 57 | 'featured', 58 | ]; 59 | 60 | $mergedKeys = array_unique(array_merge($defaultKeys, $keys)); 61 | 62 | $resource = fopen($url, 'r'); 63 | 64 | if ($resource === false) 65 | { 66 | yield new RuntimeException('Could not read csv file', 500); 67 | } 68 | 69 | try 70 | { 71 | //NON-BLOCKING I/O (Does not wait before processing next line.) 72 | stream_set_blocking($resource, false); 73 | 74 | do 75 | { 76 | $currentLine = stream_get_line( 77 | $resource, 78 | 0, 79 | "\r\n" 80 | ); 81 | 82 | if (empty($currentLine)) 83 | { 84 | yield new RuntimeException('Current line MUST NOT be empty', 422); 85 | } 86 | 87 | $extractedContent = str_getcsv($currentLine); 88 | 89 | if ($mergedKeys != $extractedContent) 90 | { 91 | $encodedContent = json_encode(array_combine($mergedKeys, $extractedContent)); 92 | 93 | yield $encodedContent; 94 | } 95 | yield new RuntimeException('Current line seem to be invalid', 422); 96 | } while (!feof($resource)); 97 | } finally 98 | { 99 | fclose($resource); 100 | } 101 | }; 102 | 103 | // Read CSV in a PHP Generator using streams in non-blocking I/O mode 104 | $streamCsv = $generator($csvUrl, $customFieldKeys); 105 | 106 | // Process data returned by the PHP Generator 107 | $process = function (string $givenHttpVerb, string $endpoint, string $dataString, array $headers, int $timeout, $transport) { 108 | curl_setopt_array($transport, [ 109 | CURLOPT_URL => $endpoint, 110 | CURLOPT_RETURNTRANSFER => true, 111 | CURLOPT_ENCODING => 'utf-8', 112 | CURLOPT_MAXREDIRS => 10, 113 | CURLOPT_TIMEOUT => $timeout, 114 | CURLOPT_FOLLOWLOCATION => true, 115 | CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_2TLS, 116 | CURLOPT_CUSTOMREQUEST => $givenHttpVerb, 117 | CURLOPT_POSTFIELDS => $dataString, 118 | CURLOPT_HTTPHEADER => $headers, 119 | ] 120 | ); 121 | 122 | $response = curl_exec($transport); 123 | // Might slow down the script but at least shows what's going on 124 | echo $response . PHP_EOL; 125 | 126 | return $response; 127 | }; 128 | 129 | foreach ($streamCsv as $dataString) 130 | { 131 | if (!is_string($dataString)) 132 | { 133 | continue; 134 | } 135 | $curl = curl_init(); 136 | try 137 | { 138 | // HTTP request headers 139 | $headers = [ 140 | 'Accept: application/vnd.api+json', 141 | 'Content-Type: application/json', 142 | 'Content-Length: ' . mb_strlen($dataString), 143 | sprintf('X-Joomla-Token: %s', trim($token)), 144 | ]; 145 | 146 | $output = $process($httpVerb, $endpoint($baseUrl, $basePath, (int) (json_decode($dataString, true)['id'])), $dataString, $headers, $timeout, $curl); 147 | // Continue even on partial failure 148 | if (empty($output) || array_key_exists('errors', json_decode($output, true))) 149 | { 150 | continue; 151 | } 152 | } 153 | catch (Throwable $e) 154 | { 155 | echo $e->getMessage() . PHP_EOL; 156 | continue; 157 | } finally 158 | { 159 | curl_close($curl); 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /using-raw-php/smart-add-edit-random-defined-sites-github-graphql.php: -------------------------------------------------------------------------------- 1 | 0 in csv it's doing a PATCH. If alias exists it add a random slug at the end of your alias and do PATCH again 8 | * 9 | * @author Alexandre ELISÉ 10 | * @copyright (c) 2009 - present. Alexandre ELISÉ. All rights reserved. 11 | * @license GNU Affero General Public License version 3 (AGPLv3) 12 | * @link https://apiadept.com 13 | */ 14 | 15 | // Your GitHub GraphQL API endpoint url 16 | $dataSourceUrl = 'https://api.github.com/graphql'; 17 | 18 | // Your GitHub Personal Token (classic) (CHANGE WITH YOUR OWN TOKEN) 19 | $dataSourceToken = 'ghp_yourowngithubpersonalclassictoken'; 20 | 21 | // Your repository owner (CHANGE THIS WITH YOUR OWN) 22 | $yourRepositoryOwner = 'alexandreelise'; 23 | 24 | // Your repository name (CHANGE THIS WITH YOUR OWN) 25 | $yourRepositoryName = 'j4x-api-examples'; 26 | 27 | // Your Joomla! 4.x website base url 28 | $baseUrl = [ 29 | 'app-001' => 'https://app-001.example.org', 30 | 'app-002' => 'https://app-002.example.org', 31 | 'app-003' => 'https://app-003.example.org', 32 | ]; 33 | // Your Joomla! 4.x Api Token (DO NOT STORE IT IN YOUR REPO USE A VAULT OR A PASSWORD MANAGER) 34 | $token = [ 35 | 'app-001' => 'yourownjoomlaapitoken', 36 | 'app-002' => 'yourownjoomlaapitoken', 37 | 'app-003' => 'yourownjoomlaapitoken', 38 | ]; 39 | $basePath = 'api/index.php/v1'; 40 | 41 | 42 | // Request timeout 43 | $timeout = 10; 44 | 45 | // PHP Generator to efficiently process GitHub GraphQL Api response 46 | $generator = function (string $dataSourceResponse, array $appIndexes): Generator { 47 | 48 | if (empty($dataSourceResponse)) 49 | { 50 | yield new RuntimeException('Github GraphQL Api response MUST NOT be empty', 422); 51 | } 52 | 53 | $defaultKeys = [ 54 | 'id', 55 | 'access', 56 | 'title', 57 | 'alias', 58 | 'catid', 59 | 'articletext', 60 | 'introtext', 61 | 'fulltext', 62 | 'language', 63 | 'metadesc', 64 | 'metakey', 65 | 'state', 66 | 'featured', 67 | 'tokenindex', 68 | ]; 69 | 70 | // Assess robustness of the code by trying random key order 71 | //shuffle($mergedKeys); 72 | 73 | $resource = json_decode($dataSourceResponse); 74 | 75 | if ($resource === false) 76 | { 77 | yield new RuntimeException('Could not read response', 500); 78 | } 79 | 80 | try 81 | { 82 | $repositoryName = $resource->data->repository->name; 83 | $repositoryUrl = $resource->data->repository->url; 84 | 85 | $id = 0; 86 | $title = sprintf('Stargazers of your %s Github repository', $repositoryName); 87 | $alias = ''; 88 | $catid = 2; 89 | $language = '*'; 90 | $metadesc = ''; 91 | $metakey = ''; 92 | $state = 1; 93 | $featured = 0; 94 | $access = 1; 95 | //choosen random tokenindex to deploy result to random url matched by this tokenindex 96 | $tokenindex = array_rand($appIndexes); 97 | 98 | $introtext = <<Want to know who are your repo stargazers? Here they are

100 | HTML; 101 | 102 | $stargazerList = ''; 103 | foreach ($resource->data->repository->stargazers->edges as $stargazer) 104 | { 105 | $stargazerList .= sprintf('
  • %s
  • ', $stargazer->node->name); 106 | } 107 | 108 | $fulltext = <<The stargazers for your GitHub repository named: $repositoryName

    110 |
      111 | $stargazerList 112 |
    113 | HTML; 114 | $articletext = << 117 | $fulltext 118 | HTML; 119 | 120 | yield json_encode( 121 | array_combine( 122 | $defaultKeys, 123 | [ 124 | $id, 125 | $access, 126 | $title, 127 | $alias, 128 | $catid, 129 | $articletext, 130 | $introtext, 131 | $fulltext, 132 | $language, 133 | $metadesc, 134 | $metakey, 135 | $state, 136 | $featured, 137 | $tokenindex, 138 | ] 139 | ) 140 | ); 141 | } finally 142 | { 143 | echo 'DONE processing data' . PHP_EOL; 144 | } 145 | }; 146 | 147 | // This time we need endpoint to be a function to make it more dynamic 148 | $endpoint = function (string $givenBaseUrl, string $givenBasePath, int $givenResourceId = 0): string { 149 | return $givenResourceId ? sprintf('%s/%s/%s/%d', $givenBaseUrl, $givenBasePath, 'content/articles', $givenResourceId) 150 | : sprintf('%s/%s/%s', $givenBaseUrl, $givenBasePath, 'content/articles'); 151 | }; 152 | 153 | // Process data returned by the PHP Generator 154 | $process = function (string $givenHttpVerb, string $endpoint, string $dataString, array $headers, int $timeout, $transport) { 155 | curl_setopt_array($transport, [ 156 | CURLOPT_URL => $endpoint, 157 | CURLOPT_RETURNTRANSFER => true, 158 | CURLOPT_ENCODING => 'utf-8', 159 | CURLOPT_MAXREDIRS => 10, 160 | CURLOPT_TIMEOUT => $timeout, 161 | CURLOPT_FOLLOWLOCATION => true, 162 | CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2, 163 | CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_2TLS, 164 | CURLOPT_CUSTOMREQUEST => $givenHttpVerb, 165 | CURLOPT_POSTFIELDS => $dataString, 166 | CURLOPT_HTTPHEADER => $headers, 167 | ] 168 | ); 169 | 170 | $response = curl_exec($transport); 171 | // Continue even on partial failure 172 | if (empty($response)) 173 | { 174 | throw new RuntimeException('Empty output', 422); 175 | } 176 | 177 | return $response; 178 | }; 179 | 180 | // Airtable Api response (First call to GET all records of specific table) 181 | $dataSourceHttpVerb = 'POST'; 182 | $graphQL = <<tokenindex])), 240 | ]; 241 | 242 | // Article primary key. Usually 'id' 243 | $pk = (int) $decodedDataString->id; 244 | $output = $process($pk ? 'PATCH' : 'POST', $endpoint($baseUrl[$decodedDataString->tokenindex], $basePath, $pk), $dataString, $headers, $timeout, $curl); 245 | 246 | $decodedJsonOutput = json_decode($output); 247 | 248 | // don't show errors, handle them gracefully 249 | if (isset($decodedJsonOutput->errors)) 250 | { 251 | // If article is potentially a duplicate (already exists with same alias) 252 | $storage[] = ['mightExists' => $decodedJsonOutput->errors[0]->code === 400, 'decodedDataString' => $decodedDataString]; 253 | continue; 254 | } 255 | echo $output . PHP_EOL; 256 | } 257 | catch (Throwable $streamDataThrowable) 258 | { 259 | echo $streamDataThrowable->getMessage() . PHP_EOL; 260 | continue; 261 | } finally 262 | { 263 | curl_close($curl); 264 | } 265 | } 266 | // Handle errors and retries 267 | foreach ($storage as $item) 268 | { 269 | $storageCurl = curl_init(); 270 | try 271 | { 272 | if ($item['mightExists']) 273 | { 274 | $pk = (int) $item['decodedDataString']->id; 275 | $item['decodedDataString']->alias = sprintf('%s-%s', $item['decodedDataString']->alias, bin2hex(random_bytes(4))); 276 | // No need to do another json_encode anymore 277 | $dataString = json_encode($item['decodedDataString']); 278 | // HTTP request headers 279 | $headers = [ 280 | 'Accept: application/vnd.api+json', 281 | 'Content-Type: application/json', 282 | 'Content-Length: ' . mb_strlen($dataString), 283 | sprintf('X-Joomla-Token: %s', trim($token[$item['decodedDataString']->tokenindex])), 284 | ]; 285 | $output = $process($pk ? 'PATCH' : 'POST', $endpoint($baseUrl[$item['decodedDataString']->tokenindex], $basePath, $pk), $dataString, $headers, $timeout, $storageCurl); 286 | echo $output . PHP_EOL; 287 | } 288 | } 289 | catch (Throwable $storageThrowable) 290 | { 291 | echo $storageThrowable->getMessage() . PHP_EOL; 292 | continue; 293 | } finally 294 | { 295 | curl_close($storageCurl); 296 | } 297 | } 298 | } 299 | catch (Throwable $e) 300 | { 301 | echo $e->getMessage() . PHP_EOL; 302 | } finally 303 | { 304 | curl_close($dataSourceTransport); 305 | } 306 | -------------------------------------------------------------------------------- /using-raw-php/smart-add-edit-to-multiple-sites-airtable-api.php: -------------------------------------------------------------------------------- 1 | 0 in csv it's doing a PATCH. If alias exists it add a random slug at the end of your alias and do PATCH again 8 | * 9 | * @author Alexandre ELISÉ 10 | * @copyright (c) 2009 - present. Alexandre ELISÉ. All rights reserved. 11 | * @license GNU Affero General Public License version 3 (AGPLv3) 12 | * @link https://apiadept.com 13 | */ 14 | 15 | // Your Airtable endpoint url (CHANGE WITH YOUR OWN URL IF YOU WISH) 16 | $dataSourceUrl = 'https://api.airtable.com/v0/apptBHEIQEEuQZDUg/tblVWSWobBIo5q6bX'; 17 | 18 | // Your Airtable Api token 19 | $dataSourceToken = 'yourairtableapikey'; 20 | 21 | 22 | // Your Joomla! 4.x website base url 23 | $baseUrl = [ 24 | 'app-001' => 'https://app-001.example.org', 25 | 'app-002' => 'https://app-002.example.org', 26 | 'app-003' => 'https://app-003.example.org', 27 | ]; 28 | // Your Joomla! 4.x Api Token (DO NOT STORE IT IN YOUR REPO USE A VAULT OR A PASSWORD MANAGER) 29 | $token = [ 30 | 'app-001' => 'yourapp001joomlaapitoken', 31 | 'app-002' => 'yourapp002joomlaapitoken', 32 | 'app-003' => 'yourapp003joomlaapitoken', 33 | ]; 34 | $basePath = 'api/index.php/v1'; 35 | 36 | 37 | // Request timeout 38 | $timeout = 10; 39 | 40 | // Add custom fields support (shout-out to Marc DECHÈVRE : CUSTOM KING) 41 | // The keys are the columns in the csv with the custom fields names (that's how Joomla! Web Services Api work as of today) 42 | // For the custom fields to work they need to be added in the csv and to exists in the Joomla! site. 43 | $customFieldKeys = []; //['with-coffee','with-dessert','extra-water-bottle']; 44 | 45 | 46 | // This time we need endpoint to be a function to make it more dynamic 47 | $endpoint = function (string $givenBaseUrl, string $givenBasePath, int $givenResourceId = 0): string { 48 | return $givenResourceId ? sprintf('%s/%s/%s/%d', $givenBaseUrl, $givenBasePath, 'content/articles', $givenResourceId) 49 | : sprintf('%s/%s/%s', $givenBaseUrl, $givenBasePath, 'content/articles'); 50 | }; 51 | 52 | // PHP Generator to efficiently process Airtable Api response 53 | $generator = function (string $airtableResponse, array $keys): Generator { 54 | 55 | if (empty($airtableResponse)) 56 | { 57 | yield new RuntimeException('Url MUST NOT be empty', 422); 58 | } 59 | 60 | $defaultKeys = [ 61 | 'id', 62 | 'access', 63 | 'title', 64 | 'alias', 65 | 'catid', 66 | 'articletext', 67 | 'introtext', 68 | 'fulltext', 69 | 'language', 70 | 'metadesc', 71 | 'metakey', 72 | 'state', 73 | 'featured', 74 | 'images', 75 | 'urls', 76 | 'tokenindex', 77 | 'picture', 78 | ]; 79 | 80 | $mergedKeys = empty($keys) ? $defaultKeys : array_unique(array_merge($defaultKeys, $keys)); 81 | 82 | // Assess robustness of the code by trying random key order 83 | //shuffle($mergedKeys); 84 | 85 | $resource = json_decode($airtableResponse); 86 | 87 | if ($resource === false) 88 | { 89 | yield new RuntimeException('Could not read airtable response', 500); 90 | } 91 | 92 | try 93 | { 94 | if (is_array($resource->records) && empty($resource->records)) 95 | { 96 | throw new RuntimeException('No records found in your Airtable table. Cannot continue.', 422); 97 | } 98 | $picturePath = __DIR__ . '/images/'; 99 | 100 | $downloadPicture = function (stdClass $givenPicture, string $destination) { 101 | if (!property_exists($givenPicture, 'url')) 102 | { 103 | throw new DomainException('Cannot download current picture. Malformed datastructure url and filename MUST be present in givenPicture class parameter', 422); 104 | } 105 | if (empty($destination)) 106 | { 107 | throw new DomainException('Destination path for pictures download MUST not be empty', 422); 108 | } 109 | $contentType = explode(';', get_headers($givenPicture->url, true)['Content-Type'])[0]; 110 | if (!in_array($contentType, ['image/png', 'image/jpeg', 'image/jpg', 'image/gif'], true)) 111 | { 112 | throw new DomainException('Picture format not allowed at the moment', 415); 113 | } 114 | $imageData = file_get_contents($givenPicture->url); 115 | if (!file_exists($destination)) 116 | { 117 | mkdir($destination, 0700, true); 118 | } 119 | $destinationFile = sprintf('%s/%s.%s', $destination, hash('sha3-512', $imageData, false), explode('/', $contentType)[1]); 120 | if (!file_exists($destinationFile)) 121 | { 122 | file_put_contents($destinationFile, $imageData); 123 | } 124 | }; 125 | 126 | foreach ($resource->records as $record) 127 | { 128 | if (empty((array) $record->fields)) 129 | { 130 | echo 'No fields found in this record' . PHP_EOL; 131 | continue; 132 | } 133 | foreach ($record->fields as $fieldKey => $fieldValue) 134 | { 135 | if (!in_array($fieldKey, $mergedKeys, true)) 136 | { 137 | unset($record->fields->$fieldKey); 138 | } 139 | if (!isset($record->fields->$fieldKey)) 140 | { 141 | continue; 142 | } 143 | if (is_string($fieldValue) && mb_strpos($fieldValue, '{') === 0) 144 | { 145 | //IMPORTANT: This one line allows to see intro/fulltext images and urla,urlb,urlc 146 | $record->fields->$fieldKey = json_decode(str_replace(["\n", "\r", "\t"], '', trim($fieldValue))); 147 | 148 | if ($fieldKey === 'images') 149 | { 150 | $moreThanOnePicture = []; 151 | foreach ($record->fields->picture as $index => $currentPicture) 152 | { 153 | try 154 | { 155 | // In all case we want to download the full thumbnail 156 | $downloadPicture($currentPicture->thumbnails->large, $picturePath); 157 | if ($index === 0) 158 | { 159 | //Just for the first image we want to download both full and large 160 | $downloadPicture($currentPicture->thumbnails->full, $picturePath); 161 | 162 | $record->fields->images->image_intro = $currentPicture->thumbnails->large->url; 163 | $record->fields->images->image_fulltext = $currentPicture->thumbnails->full->url; 164 | } 165 | $moreThanOnePicture[] = << 167 | 168 |
    Picture from Datasource - Airtable
    169 | 170 | MEDIA; 171 | } 172 | catch (Throwable $pictureDownloadThrowable) 173 | { 174 | // On failure to download images try to add them as url anyway 175 | $record->fields->images->image_intro = $currentPicture->thumbnails->large->url; 176 | $record->fields->images->image_fulltext = $currentPicture->thumbnails->full->url; 177 | echo $pictureDownloadThrowable->getTraceAsString() . PHP_EOL; 178 | continue; 179 | } 180 | } 181 | 182 | //Prepend articletext and fulltext when there is more than 1 picture provided in the Airtable attachments fields 183 | $record->fields->articletext = sprintf('%s

    %s', implode('', $moreThanOnePicture), $record->fields->articletext); 184 | $record->fields->fulltext = sprintf('%s

    %s', implode('', $moreThanOnePicture), $record->fields->fulltext); 185 | 186 | } 187 | } 188 | } 189 | // Re-encode the fields to send it back as JSON 190 | yield json_encode($record->fields); 191 | } 192 | } finally 193 | { 194 | echo 'DONE processing data' . PHP_EOL; 195 | } 196 | }; 197 | 198 | // Process data returned by the PHP Generator 199 | $process = function (string $givenHttpVerb, string $endpoint, string $dataString, array $headers, int $timeout, $transport) { 200 | curl_setopt_array($transport, [ 201 | CURLOPT_URL => $endpoint, 202 | CURLOPT_RETURNTRANSFER => true, 203 | CURLOPT_ENCODING => 'utf-8', 204 | CURLOPT_MAXREDIRS => 10, 205 | CURLOPT_TIMEOUT => $timeout, 206 | CURLOPT_FOLLOWLOCATION => true, 207 | CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2, 208 | CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_2TLS, 209 | CURLOPT_CUSTOMREQUEST => $givenHttpVerb, 210 | CURLOPT_POSTFIELDS => $dataString, 211 | CURLOPT_HTTPHEADER => $headers, 212 | ] 213 | ); 214 | 215 | $response = curl_exec($transport); 216 | // Continue even on partial failure 217 | if (empty($response)) 218 | { 219 | throw new RuntimeException('Empty output', 422); 220 | } 221 | 222 | return $response; 223 | }; 224 | 225 | // Airtable Api response (First call to GET all records of specific table) 226 | $dataSourceHttpVerb = 'GET'; 227 | $dataSourceHeaders = [ 228 | 'Accept: application/json', 229 | sprintf('Authorization: Bearer %s', trim($dataSourceToken)), 230 | ]; 231 | $dataSourceTimeout = 30; 232 | 233 | // Response from Airtable Api 234 | $dataSourceTransport = curl_init(); 235 | try 236 | { 237 | $dataSourceResponse = $process($dataSourceHttpVerb, $dataSourceUrl, '', $dataSourceHeaders, $dataSourceTimeout, $dataSourceTransport); 238 | 239 | $streamData = $generator($dataSourceResponse, $customFieldKeys); 240 | $storage = []; 241 | foreach ($streamData as $dataKey => $dataString) 242 | { 243 | if (!is_string($dataString)) 244 | { 245 | continue; 246 | } 247 | $curl = curl_init(); 248 | try 249 | { 250 | $decodedDataString = json_decode($dataString); 251 | if ($decodedDataString === false) 252 | { 253 | continue; 254 | } 255 | 256 | // HTTP request headers 257 | $headers = [ 258 | 'Accept: application/vnd.api+json', 259 | 'Content-Type: application/json', 260 | 'Content-Length: ' . mb_strlen($dataString), 261 | sprintf('X-Joomla-Token: %s', trim($token[$decodedDataString->tokenindex])), 262 | ]; 263 | 264 | // Article primary key. Usually 'id' 265 | $pk = (int) $decodedDataString->id; 266 | $output = $process($pk ? 'PATCH' : 'POST', $endpoint($baseUrl[$decodedDataString->tokenindex], $basePath, $pk), $dataString, $headers, $timeout, $curl); 267 | 268 | $decodedJsonOutput = json_decode($output); 269 | 270 | // don't show errors, handle them gracefully 271 | if (isset($decodedJsonOutput->errors)) 272 | { 273 | // If article is potentially a duplicate (already exists with same alias) 274 | $storage[$dataKey] = ['mightExists' => $decodedJsonOutput->errors[0]->code === 400, 'decodedDataString' => $decodedDataString]; 275 | continue; 276 | } 277 | echo $output . PHP_EOL; 278 | } 279 | catch (Throwable $streamDataThrowable) 280 | { 281 | echo $streamDataThrowable->getTraceAsString() . PHP_EOL; 282 | continue; 283 | } finally 284 | { 285 | curl_close($curl); 286 | } 287 | } 288 | // Handle errors and retries 289 | foreach ($storage as $item) 290 | { 291 | $storageCurl = curl_init(); 292 | try 293 | { 294 | if ($item['mightExists']) 295 | { 296 | $pk = (int) $item['decodedDataString']->id; 297 | $item['decodedDataString']->alias = sprintf('%s-%s', $item['decodedDataString']->alias, bin2hex(random_bytes(4))); 298 | // No need to do another json_encode anymore 299 | $dataString = json_encode($item['decodedDataString']); 300 | // HTTP request headers 301 | $headers = [ 302 | 'Accept: application/vnd.api+json', 303 | 'Content-Type: application/json', 304 | 'Content-Length: ' . mb_strlen($dataString), 305 | sprintf('X-Joomla-Token: %s', trim($token[$item['decodedDataString']->tokenindex])), 306 | ]; 307 | $output = $process($pk ? 'PATCH' : 'POST', $endpoint($baseUrl[$item['decodedDataString']->tokenindex], $basePath, $pk), $dataString, $headers, $timeout, $storageCurl); 308 | echo $output . PHP_EOL; 309 | } 310 | } 311 | catch (Throwable $storageThrowable) 312 | { 313 | echo $storageThrowable->getTraceAsString() . PHP_EOL; 314 | continue; 315 | } finally 316 | { 317 | curl_close($storageCurl); 318 | } 319 | } 320 | } 321 | catch (Throwable $e) 322 | { 323 | echo $e->getTraceAsString() . PHP_EOL; 324 | } finally 325 | { 326 | curl_close($dataSourceTransport); 327 | } 328 | -------------------------------------------------------------------------------- /using-raw-php/smart-add-edit-to-multiple-sites-from-csv-url.php: -------------------------------------------------------------------------------- 1 | 0 in csv it's doing a PATCH. If alias exists it add a random slug at the end of your alias and do PATCH again 12 | * - Requires PHP 8.1 minimum. Now uses PHP Fibers. 13 | * 14 | * This is the last version of the script. Future development will shift focus on the new Joomla Console script. 15 | * Will develop future version using a Joomla Console Custom Plugin. Crafted specially for CLI-based interaction. 16 | * 17 | * @author Mr Alexandre J-S William ELISÉ 18 | * @copyright (c) 2009 - present. Mr Alexandre J-S William ELISÉ. All rights reserved. 19 | * @license GNU Affero General Public License version 3 (AGPLv3) 20 | * @link https://apiadept.com 21 | */ 22 | 23 | $asciiBanner = << 'https://app-001.example.org', 49 | 'app-002' => 'https://app-002.example.org', 50 | 'app-003' => 'https://app-003.example.org', 51 | ]; 52 | // Your Joomla! 4.x Api Token (DO NOT STORE IT IN YOUR REPO USE A VAULT OR A PASSWORD MANAGER) 53 | $token = [ 54 | 'app-001' => '', 55 | 'app-002' => '', 56 | 'app-003' => '', 57 | ]; 58 | $basePath = 'api/index.php/v1'; 59 | 60 | // Request timeout 61 | $timeout = 3; // Shorter request timeout. Usually it won't take more than 1 sec to connect. Otherwise, you might have a bigger problem to tackle. 62 | 63 | // Add custom fields support (shout-out to Marc DECHÈVRE : CUSTOM KING) 64 | // The keys are the columns in the csv with the custom fields names (that's how Joomla! Web Services Api work as of today) 65 | // For the custom fields to work they need to be added in the csv and to exists in the Joomla! site. 66 | $customFieldKeys = []; 67 | 68 | // Silent mode 69 | // 0: hide both response result and key value pairs 70 | // 1: show response result only 71 | // 2: show key value pairs only 72 | // Set to 0 if you want to squeeze out performance of this script to the maximum 73 | $silent = 1; 74 | 75 | // Line numbers we want in any order (e.g 9,7-7,2-4,10,17-14,21). Leave empty '' to process all lines (beginning at line 2. Same as csv file) 76 | $whatLineNumbersYouWant = ''; 77 | 78 | defined('IS_CLI') || define('IS_CLI', hash_equals(PHP_SAPI, 'cli')); 79 | defined('CUSTOM_LINE_END') || define('CUSTOM_LINE_END', IS_CLI ? PHP_EOL : '
    '); 80 | defined('ANSI_COLOR_RED') || define('ANSI_COLOR_RED', IS_CLI ? "\033[31m" : ''); 81 | defined('ANSI_COLOR_GREEN') || define('ANSI_COLOR_GREEN', IS_CLI ? "\033[32m" : ''); 82 | defined('ANSI_COLOR_BLUE') || define('ANSI_COLOR_BLUE', IS_CLI ? "\033[34m" : ''); 83 | defined('ANSI_COLOR_NORMAL') || define('ANSI_COLOR_NORMAL', IS_CLI ? "\033[0m" : ''); 84 | 85 | defined('CSV_SEPARATOR') || define('CSV_SEPARATOR', "\x2C"); 86 | defined('CSV_ENCLOSURE') || define('CSV_ENCLOSURE', "\x22"); 87 | defined('CSV_ESCAPE') || define('CSV_ESCAPE', "\x22"); 88 | defined('CSV_ENDING') || define('CSV_ENDING', "\x0D\x0A"); 89 | 90 | //Csv starts at line number : 2 91 | defined('CSV_START') || define('CSV_START', 2); 92 | 93 | // This MUST be a json file otherwise it might fail 94 | defined('CSV_PROCESSING_REPORT_FILEPATH') || define('CSV_PROCESSING_REPORT_FILEPATH', __DIR__ . '/output.json'); 95 | 96 | // Do you want a report after processing? 97 | // 0: no report, 1: success & errors, 2: errors only 98 | // When using report feature. Silent mode MUST be set to 1. Otherwise you might have unexpected results. 99 | // Set to 0 if you want to squeeze out performance of this script to the maximum 100 | // If enabled, this will create a output.json file 101 | $saveReportToFile = 0; 102 | 103 | // Show the ASCII Art banner or not 104 | $enviromentAwareDisplay = (IS_CLI ? $asciiBanner : sprintf('
    %s
    ', $asciiBanner)); 105 | 106 | $failedCsvLines = []; 107 | $successfulCsvLines = []; 108 | $isDone = false; 109 | 110 | $enqueueMessage = function (string $message, string $type = 'message'): void { 111 | // Ignore empty messages 112 | if (empty($message)) { 113 | return; 114 | } 115 | echo $message; 116 | }; 117 | 118 | $enqueueMessage( 119 | $showAsciiBanner ? sprintf( 120 | '%s %s %s%s', 121 | ANSI_COLOR_BLUE, 122 | $enviromentAwareDisplay, 123 | ANSI_COLOR_NORMAL, 124 | CUSTOM_LINE_END, 125 | ) : '', 126 | ); 127 | 128 | $computedLineNumbers = function (string $wantedLineNumbers = '') { 129 | // When strictly empty process every Csv lines (Full range) 130 | if ($wantedLineNumbers === '') { 131 | return []; 132 | } 133 | 134 | // Cut-off useless processing when single digit range 135 | if (strlen($wantedLineNumbers) === 1) { 136 | return (((int)$wantedLineNumbers) < CSV_START) ? [CSV_START] : [((int)$wantedLineNumbers)]; 137 | } 138 | 139 | $commaParts = explode(',', $wantedLineNumbers); 140 | if (empty($commaParts)) { 141 | return []; 142 | } 143 | sort($commaParts, SORT_NATURAL); 144 | $output = []; 145 | foreach ($commaParts as $commaPart) { 146 | if (!str_contains($commaPart, '-')) { 147 | // First line is the header, so we MUST start at least at line 2. Hence, 2 or more 148 | $result1 = (((int)$commaPart) > 1) ? ((int)$commaPart) : CSV_START; 149 | // Makes it unique in output array 150 | if (!in_array($result1, $output, true)) { 151 | $output[] = $result1; 152 | } 153 | // Skip to next comma part 154 | continue; 155 | } 156 | // maximum 1 dash "group" per comma separated "groups" 157 | $dashParts = explode('-', $commaPart, 2); 158 | if (empty($dashParts)) { 159 | // First line is the header, so we MUST start at least at line 2. Hence, 2 or more 160 | $result2 = (((int)$commaPart) > 1) ? ((int)$commaPart) : CSV_START; 161 | if (!in_array($result2, $output, true)) { 162 | $output[] = $result2; 163 | } 164 | // Skip to next comma part 165 | continue; 166 | } 167 | // First line is the header, so we MUST start at least at line 2. Hence, 2 or more 168 | $dashParts[0] = (((int)$dashParts[0]) > 1) ? ((int)$dashParts[0]) : CSV_START; 169 | 170 | // First line is the header, so we MUST start at least at line 2. Hence, 2 or more 171 | $dashParts[1] = (((int)$dashParts[1]) > 1) ? ((int)$dashParts[1]) : CSV_START; 172 | 173 | // Only store one digit if both are the same in the range 174 | if (($dashParts[0] === $dashParts[1]) && (!in_array($dashParts[0], $output, true))) { 175 | $output[] = $dashParts[0]; 176 | } elseif ($dashParts[0] > $dashParts[1]) { 177 | // Store expanded range of numbers 178 | $output = array_merge($output, range($dashParts[1], $dashParts[0])); 179 | } else { 180 | // Store expanded range of numbers 181 | $output = array_merge($output, range($dashParts[0], $dashParts[1])); 182 | } 183 | } 184 | // De-dupe and sort again at the end to tidy up everything 185 | $unique = array_unique($output); 186 | // For some reason out of my understanding sort feature in array_unique won't work as expected for me, so I do sort separately 187 | sort($unique, SORT_NATURAL | SORT_ASC); 188 | 189 | return $unique; 190 | }; 191 | 192 | // This time we need endpoint to be a function to make it more dynamic 193 | $endpoint = fn(string $givenBaseUrl, string $givenBasePath, int $givenResourceId = 0): string 194 | => $givenResourceId ? sprintf( 195 | '%s/%s/%s/%d', 196 | $givenBaseUrl, 197 | $givenBasePath, 198 | 'content/articles', 199 | $givenResourceId, 200 | ) 201 | : sprintf('%s/%s/%s', $givenBaseUrl, $givenBasePath, 'content/articles'); 202 | 203 | // handle nested json 204 | $nested = function (array $arr, callable $enqueueMessageCallable, int $isSilent = 0): array { 205 | $handleComplexValues = []; 206 | $iterator = new RecursiveIteratorIterator( 207 | new RecursiveArrayIterator($arr), 208 | RecursiveIteratorIterator::CATCH_GET_CHILD, 209 | ); 210 | foreach ($iterator as $key => $value) { 211 | if (str_starts_with($value, '{')) { 212 | if ($isSilent == 2) { 213 | $enqueueMessageCallable( 214 | sprintf( 215 | '%s item with key: %s with value: %s%s%s', 216 | ANSI_COLOR_BLUE, 217 | $key, 218 | $value, 219 | ANSI_COLOR_NORMAL, 220 | CUSTOM_LINE_END, 221 | ), 222 | ); 223 | } 224 | // Doesn't seem to make sense at first but this one line allows to show intro/fulltext images and urla,urlb,urlc 225 | $handleComplexValues[$key] = json_decode(str_replace(["\n", "\r", "\t"], '', trim($value))); 226 | } elseif (json_decode($value) === false) { 227 | $handleComplexValues[$key] = json_encode($value); 228 | if ($isSilent == 2) { 229 | $enqueueMessageCallable( 230 | sprintf( 231 | '%s item with key: %s with value: %s%s%s', 232 | ANSI_COLOR_BLUE, 233 | $key, 234 | $value, 235 | ANSI_COLOR_NORMAL, 236 | CUSTOM_LINE_END, 237 | ), 238 | ); 239 | } 240 | } else { 241 | $handleComplexValues[$key] = $value; 242 | if ($isSilent == 2) { 243 | $enqueueMessageCallable( 244 | sprintf( 245 | '%s item with key: %s with value: %s%s%s', 246 | ANSI_COLOR_BLUE, 247 | $key, 248 | $value, 249 | ANSI_COLOR_NORMAL, 250 | CUSTOM_LINE_END, 251 | ), 252 | ); 253 | } 254 | } 255 | } 256 | 257 | return $handleComplexValues; 258 | }; 259 | 260 | $csvReader = function ( 261 | string $url, 262 | array $keys, 263 | callable $givenNested, 264 | callable $enqueueMessageCallable, 265 | int $isSilent = 1, 266 | array $lineRange = [], 267 | ?callable $handler = null, 268 | array &$failed = [], 269 | array &$successful = [], 270 | bool &$isFinished = false, 271 | ) { 272 | if (empty($url)) { 273 | throw new RuntimeException('Url MUST NOT be empty', 422); 274 | } 275 | 276 | $defaultKeys = [ 277 | 'id', 278 | 'access', 279 | 'title', 280 | 'alias', 281 | 'catid', 282 | 'articletext', 283 | 'introtext', 284 | 'fulltext', 285 | 'language', 286 | 'metadesc', 287 | 'metakey', 288 | 'state', 289 | 'featured', 290 | 'images', 291 | 'urls', 292 | 'tokenindex', 293 | ]; 294 | 295 | $mergedKeys = empty($keys) ? $defaultKeys : array_unique(array_merge($defaultKeys, $keys)); 296 | 297 | // Assess robustness of the code by trying random key order 298 | //shuffle($mergedKeys); 299 | 300 | $resource = fopen($url, 'r'); 301 | 302 | if ($resource === false) { 303 | throw new RuntimeException('Could not read csv file', 500); 304 | } 305 | 306 | try { 307 | stream_set_blocking($resource, false); 308 | 309 | $firstLine = stream_get_line( 310 | $resource, 311 | 0, 312 | "\r\n", 313 | ); 314 | 315 | if (!is_string($firstLine) || empty($firstLine)) { 316 | throw new RuntimeException('First line MUST NOT be empty. It is the header', 422); 317 | } 318 | 319 | $csvHeaderKeys = str_getcsv($firstLine); 320 | $commonKeys = array_intersect($csvHeaderKeys, $mergedKeys); 321 | $currentCsvLineNumber = 1; 322 | $isExpanded = ($lineRange !== []); 323 | 324 | if ($isExpanded) { 325 | if (count($lineRange) === 1) { 326 | $minLineNumber = $lineRange[0]; 327 | $maxLineNumber = $lineRange[0]; 328 | } else { 329 | // Rather than starting from 1 which is not that efficient, start from minimum value in CSV line range 330 | $minLineNumber = min($lineRange); 331 | $maxLineNumber = max($lineRange); 332 | } 333 | } 334 | 335 | while (!$isFinished && !feof($resource)) { 336 | $currentLine = stream_get_line( 337 | $resource, 338 | 0, 339 | "\r\n", 340 | ); 341 | if (!is_string($currentLine) || empty($currentLine)) { 342 | continue; 343 | } 344 | // Again, for a more efficient algorithm. Do not do unecessary processing, unless we have to. 345 | $isEdgeCaseSingleLineInRange = ($isExpanded && (count($lineRange) === 1)); 346 | if (!$isExpanded || (count($lineRange) > 1) || $isEdgeCaseSingleLineInRange) { 347 | $currentCsvLineNumber += 1; 348 | 349 | if ($isEdgeCaseSingleLineInRange && ($currentCsvLineNumber < $minLineNumber)) { 350 | continue; // Continue until we reach the line we want 351 | } 352 | } 353 | 354 | $extractedContent = str_getcsv($currentLine, CSV_SEPARATOR, CSV_ENCLOSURE, CSV_ESCAPE); 355 | 356 | // Skip empty lines 357 | if (empty($extractedContent)) { 358 | continue; 359 | } 360 | 361 | // Allow using csv keys in any order 362 | $commonValues = array_intersect_key($extractedContent, $commonKeys); 363 | 364 | // Skip invalid lines 365 | if (empty($commonValues)) { 366 | continue; 367 | } 368 | 369 | // Iteration on leafs AND nodes 370 | $handleComplexValues = $givenNested($commonValues, $enqueueMessageCallable, $isSilent); 371 | 372 | try { 373 | $encodedContent = json_encode(array_combine($commonKeys, $handleComplexValues), JSON_THROW_ON_ERROR); 374 | 375 | // Stop processing immediately if it goes beyond range 376 | if (($isExpanded && (count($lineRange) > 1)) && ($currentCsvLineNumber > $maxLineNumber)) { 377 | $isFinished = true; 378 | throw new DomainException( 379 | sprintf('Processing of CSV file done. Last line processed was line %d', $currentCsvLineNumber), 380 | 200, 381 | ); 382 | } 383 | 384 | if ($encodedContent === false) { 385 | throw new RuntimeException('Current line seem to be invalid', 422); 386 | } elseif (!$isFinished && ((is_string($encodedContent) && (($isExpanded && in_array( 387 | $currentCsvLineNumber, 388 | $lineRange, 389 | true, 390 | )) || !$isExpanded)) && is_callable($handler))) { 391 | $handler(['line' => $currentCsvLineNumber, 'content' => $encodedContent]); 392 | 393 | // Only 1 element in range. Don't do useless processing after first round. 394 | if ($isExpanded && ((count($lineRange) === 1) && ($currentCsvLineNumber === $maxLineNumber))) { 395 | $isFinished = true; 396 | throw new DomainException( 397 | sprintf( 398 | 'Processing of CSV file done. Last line processed was line %d', 399 | $currentCsvLineNumber, 400 | ), 200, 401 | ); 402 | } 403 | } 404 | } catch (DomainException $domainException) { 405 | $successful[$currentCsvLineNumber] = $domainException->getMessage(); 406 | throw $domainException; 407 | } catch (Throwable $encodeContentException) { 408 | $failed[$currentCsvLineNumber] = [ 409 | 'error' => $encodeContentException->getMessage(), 410 | 'error_line' => $encodeContentException->getLine(), 411 | ]; // Store failed CSV line numbers for end report. 412 | continue; // Ignore failed CSV lines 413 | } 414 | } 415 | } catch (DomainException $domainException) { 416 | if (isset($resource) && is_resource($resource)) { 417 | fclose($resource); 418 | } 419 | throw $domainException; 420 | } catch (Throwable $e) { 421 | if ($isSilent == 1) { 422 | $enqueueMessageCallable( 423 | sprintf( 424 | '%s Error message: %s, Error code line: %d, Error CSV Line: %d%s%s', 425 | ANSI_COLOR_RED, 426 | $e->getMessage(), 427 | $e->getLine(), 428 | $currentCsvLineNumber, 429 | ANSI_COLOR_NORMAL, 430 | CUSTOM_LINE_END, 431 | ), 432 | 'error', 433 | ); 434 | } 435 | if (isset($resource) && is_resource($resource)) { 436 | fclose($resource); 437 | } 438 | throw $e; 439 | } finally { 440 | if (isset($resource) && is_resource($resource)) { 441 | fclose($resource); 442 | } 443 | } 444 | }; 445 | 446 | // Process data returned by the PHP Generator 447 | $process = function ( 448 | string $givenHttpVerb, 449 | string $endpoint, 450 | string $dataString, 451 | array $headers, 452 | int $timeout, 453 | CurlHandle $transport, 454 | ) { 455 | curl_setopt_array( 456 | $transport, 457 | [ 458 | CURLOPT_URL => $endpoint, 459 | CURLOPT_RETURNTRANSFER => true, 460 | CURLOPT_ENCODING => 'utf-8', 461 | CURLOPT_MAXREDIRS => 10, 462 | CURLOPT_TIMEOUT => $timeout, 463 | CURLOPT_FOLLOWLOCATION => true, 464 | CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2, 465 | CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_2TLS, 466 | CURLOPT_CUSTOMREQUEST => $givenHttpVerb, 467 | CURLOPT_POSTFIELDS => $dataString, 468 | CURLOPT_HTTPHEADER => $headers, 469 | ], 470 | ); 471 | 472 | $response = curl_exec($transport); 473 | // Continue even on partial failure 474 | if (empty($response)) { 475 | throw new RuntimeException('Empty output', 422); 476 | } 477 | 478 | return $response; 479 | }; 480 | 481 | $cpuCounter = function (): int { 482 | $procCpuInfo = file_get_contents('/proc/cpuinfo'); 483 | if (!$procCpuInfo) { 484 | throw new RuntimeException('Could not read /proc/cpuinfo', 422); 485 | } 486 | 487 | return (int)preg_match_all('/(processor)/', $procCpuInfo); 488 | }; 489 | 490 | $expandedLineNumbers = $computedLineNumbers($whatLineNumbersYouWant); 491 | $isExpanded = ($expandedLineNumbers !== []); 492 | $storage = []; 493 | 494 | // Compute number of CPUs to attempt parallel run of PHP Fibers 495 | $currentCpuCount = $cpuCounter(); 496 | $pool = new SplFixedArray($currentCpuCount); 497 | $rollingPoolIndex = 0; 498 | 499 | $poolRetry = new SplFixedArray($currentCpuCount); 500 | $rollingPoolIndexRetry = 0; 501 | 502 | $combinedHttpResponse = []; 503 | try { 504 | try { 505 | $csvReader( 506 | $csvUrl, 507 | $customFieldKeys, 508 | $nested, 509 | $enqueueMessage, 510 | $silent, 511 | $expandedLineNumbers, 512 | function ($dataValue) use ( 513 | &$storage, 514 | $endpoint, 515 | $baseUrl, 516 | $basePath, 517 | $token, 518 | $silent, 519 | $timeout, 520 | $process, 521 | $enqueueMessage, 522 | &$successfulCsvLines, 523 | $pool, 524 | $combinedHttpResponse, 525 | $rollingPoolIndex, 526 | $currentCpuCount, 527 | &$isDone, 528 | ) { 529 | if (empty($dataValue)) { 530 | return; 531 | } 532 | 533 | $dataCurrentCSVline = $dataValue['line']; 534 | $dataString = $dataValue['content']; 535 | 536 | $curl = curl_init(); 537 | 538 | if (!is_string($dataString)) { 539 | return; 540 | } 541 | 542 | $decodedDataString = json_decode($dataString, false, 512, JSON_THROW_ON_ERROR); 543 | 544 | try { 545 | if (($decodedDataString === false) || (!isset($token[$decodedDataString->tokenindex])) 546 | ) { 547 | return; 548 | } 549 | 550 | // HTTP request headers 551 | $headers = [ 552 | 'Accept: application/vnd.api+json', 553 | 'Content-Type: application/json', 554 | 'Content-Length: ' . strlen($dataString), 555 | sprintf('X-Joomla-Token: %s', trim($token[$decodedDataString->tokenindex])), 556 | ]; 557 | 558 | // Article primary key. Usually 'id' 559 | $pk = (int)$decodedDataString->id; 560 | 561 | // Circular pool of PHP Fibers based on number of "cpus detected". 562 | if (!isset($pool[$rollingPoolIndex % $currentCpuCount]) || (!($pool[$rollingPoolIndex % $currentCpuCount] instanceof Fiber))) { 563 | $pool[$rollingPoolIndex % $currentCpuCount] = new Fiber( 564 | function ( 565 | string $givenHttpVerb, 566 | string $endpoint, 567 | string $dataString, 568 | array $headers, 569 | int $timeout, 570 | CurlHandle $transport, 571 | ) use ($process, $combinedHttpResponse, $dataCurrentCSVline): void { 572 | $combinedHttpResponse[$dataCurrentCSVline] ??= $process( 573 | $givenHttpVerb, 574 | $endpoint, 575 | $dataString, 576 | $headers, 577 | $timeout, 578 | $transport, 579 | ); 580 | $args = Fiber::suspend( 581 | $combinedHttpResponse[$dataCurrentCSVline], 582 | ); 583 | $combinedHttpResponse[$dataCurrentCSVline] ??= $process(...$args); 584 | }, 585 | ); 586 | 587 | $combinedHttpResponse[$dataCurrentCSVline] ??= $pool[$rollingPoolIndex % $currentCpuCount]->start( 588 | $pk ? 'PATCH' : 'POST', 589 | $endpoint($baseUrl[$decodedDataString->tokenindex], $basePath, $pk), 590 | $dataString, 591 | $headers, 592 | $timeout, 593 | $curl, 594 | ); 595 | } elseif ($pool[$rollingPoolIndex % $currentCpuCount]->isTerminated()) { 596 | unset($pool[$rollingPoolIndex % $currentCpuCount]); // Recycle terminated PHP Fibers 597 | 598 | $pool[$rollingPoolIndex % $currentCpuCount] = new Fiber( 599 | function ( 600 | string $givenHttpVerb, 601 | string $endpoint, 602 | string $dataString, 603 | array $headers, 604 | int $timeout, 605 | CurlHandle $transport, 606 | ) use ($process, $combinedHttpResponse, $dataCurrentCSVline): void { 607 | $combinedHttpResponse[$dataCurrentCSVline] ??= $process( 608 | $givenHttpVerb, 609 | $endpoint, 610 | $dataString, 611 | $headers, 612 | $timeout, 613 | $transport, 614 | ); 615 | $args = Fiber::suspend( 616 | $combinedHttpResponse[$dataCurrentCSVline], 617 | ); 618 | $combinedHttpResponse[$dataCurrentCSVline] ??= $process(...$args); 619 | }, 620 | ); 621 | 622 | $combinedHttpResponse[$dataCurrentCSVline] ??= $pool[$rollingPoolIndex % $currentCpuCount]->start( 623 | $pk ? 'PATCH' : 'POST', 624 | $endpoint($baseUrl[$decodedDataString->tokenindex], $basePath, $pk), 625 | $dataString, 626 | $headers, 627 | $timeout, 628 | $curl, 629 | ); 630 | } 631 | 632 | while (!$pool[$rollingPoolIndex % $currentCpuCount]->isTerminated()) { 633 | $pool[$rollingPoolIndex % $currentCpuCount]->resume( 634 | [ 635 | ($pk ? 'PATCH' : 'POST'), 636 | $endpoint($baseUrl[$decodedDataString->tokenindex], $basePath, $pk), 637 | $dataString, 638 | $headers, 639 | $timeout, 640 | $curl, 641 | ], 642 | ); 643 | 644 | $decodedJsonOutput = json_decode( 645 | $combinedHttpResponse[$dataCurrentCSVline], 646 | false, 647 | 512, 648 | JSON_THROW_ON_ERROR, 649 | ); 650 | 651 | // don't show errors, handle them gracefully 652 | if (isset($decodedJsonOutput->errors) && !isset($storage[$dataCurrentCSVline])) { 653 | // If article is potentially a duplicate (already exists with same alias) 654 | $storage[$dataCurrentCSVline] = [ 655 | 'mightExists' => isset($decodedJsonOutput->errors[0]->code) && ($decodedJsonOutput->errors[0]->code === 400), 656 | 'decodedDataString' => $decodedDataString, 657 | ]; 658 | } 659 | if (isset($decodedJsonOutput->data->attributes) && !isset($successfulCsvLines[$dataCurrentCSVline])) { 660 | if ($silent == 1) { 661 | $successfulCsvLines[$dataCurrentCSVline] = sprintf( 662 | '%s Deployed to: %s, CSV Line: %d, id: %d, created: %s, title: %s, alias: %s%s%s', 663 | ANSI_COLOR_GREEN, 664 | $decodedDataString->tokenindex, 665 | $dataCurrentCSVline, 666 | $decodedJsonOutput->data->id, 667 | $decodedJsonOutput->data->attributes->created, 668 | $decodedJsonOutput->data->attributes->title, 669 | $decodedJsonOutput->data->attributes->alias, 670 | ANSI_COLOR_NORMAL, 671 | CUSTOM_LINE_END, 672 | ); 673 | 674 | $enqueueMessage($successfulCsvLines[$dataCurrentCSVline]); 675 | } 676 | } 677 | if ($isDone) { 678 | break; 679 | } 680 | } 681 | if (!$isDone) { 682 | ++$rollingPoolIndex; // Important for circular pool of PHP Fibers 683 | } 684 | } catch (Throwable $e) { 685 | if ($silent == 1) { 686 | $failedCsvLines = [ 687 | $dataCurrentCSVline => sprintf( 688 | '%s Error message: %s, Error code line: %d, Error CSV Line: %d%s%s', 689 | ANSI_COLOR_RED, 690 | $e->getMessage(), 691 | $e->getLine(), 692 | $dataCurrentCSVline, 693 | ANSI_COLOR_NORMAL, 694 | CUSTOM_LINE_END, 695 | ), 696 | ]; 697 | $enqueueMessage($failedCsvLines[$dataCurrentCSVline], 'error'); 698 | } 699 | } finally { 700 | if (isset($curl) && ($curl instanceof CurlHandle)) { 701 | curl_close($curl); 702 | } 703 | } 704 | }, 705 | $failedCsvLines, 706 | $successfulCsvLines, 707 | $isDone, 708 | );// Execute the function 709 | } catch (DomainException $domainException) { 710 | // NO-OP 711 | } catch (Throwable $e) { 712 | if ($silent == 1) { 713 | $enqueueMessage( 714 | sprintf( 715 | '%s Error message: %s, Error code line: %d, %s%s', 716 | ANSI_COLOR_RED, 717 | $e->getMessage(), 718 | $e->getLine(), 719 | ANSI_COLOR_NORMAL, 720 | CUSTOM_LINE_END, 721 | ), 722 | 'error', 723 | ); 724 | } 725 | } 726 | 727 | 728 | // Handle errors and retries 729 | foreach ($storage as $dataCurrentCSVlineToRetry => $item) { 730 | $curlRetry = curl_init(); 731 | 732 | try { 733 | if ($item['mightExists']) { 734 | // Fail early 735 | if (!isset($item['decodedDataString']->tokenindex)) { 736 | continue; // ...and handle it gracefully 737 | } 738 | 739 | $pk = (int)$item['decodedDataString']->id; 740 | $item['decodedDataString']->alias = sprintf( 741 | '%s-%s', 742 | $item['decodedDataString']->alias, 743 | bin2hex(random_bytes(4)), 744 | ); 745 | 746 | $dataString = json_encode($item['decodedDataString'], JSON_THROW_ON_ERROR); 747 | 748 | if (!is_string($dataString) || !isset($token[$item['decodedDataString']->tokenindex])) { 749 | continue; 750 | } 751 | 752 | // HTTP request headers 753 | $headers = [ 754 | 'Accept: application/vnd.api+json', 755 | 'Content-Type: application/json', 756 | 'Content-Length: ' . strlen($dataString), 757 | sprintf('X-Joomla-Token: %s', trim($token[$item['decodedDataString']->tokenindex])), 758 | ]; 759 | 760 | if (!isset($poolOutputRetry[$rollingPoolIndexRetry % $currentCpuCount])) { 761 | $poolOutputRetry[$rollingPoolIndexRetry % $currentCpuCount] = ''; 762 | } 763 | 764 | // Circular pool of PHP Fibers based on number of "cpus detected". 765 | if (!isset($poolRetry[$rollingPoolIndexRetry % $currentCpuCount]) || (!($poolRetry[$rollingPoolIndexRetry % $currentCpuCount] instanceof Fiber))) { 766 | $poolRetry[$rollingPoolIndexRetry % $currentCpuCount] = new Fiber( 767 | function ( 768 | string $givenHttpVerb, 769 | string $givenEndpoint, 770 | string $givenDataString, 771 | array $givenHeaders, 772 | int $givenTimeout, 773 | CurlHandle $givenTransport, 774 | ) use ($process, $combinedHttpResponse, $dataCurrentCSVlineToRetry): void { 775 | $combinedHttpResponse[$dataCurrentCSVlineToRetry] ??= $process( 776 | $givenHttpVerb, 777 | $givenEndpoint, 778 | $givenDataString, 779 | $givenHeaders, 780 | $givenTimeout, 781 | $givenTransport, 782 | ); 783 | $args = Fiber::suspend( 784 | $combinedHttpResponse[$dataCurrentCSVlineToRetry], 785 | ); 786 | $combinedHttpResponse[$dataCurrentCSVlineToRetry] ??= $process(...$args); 787 | }, 788 | ); 789 | 790 | $combinedHttpResponse[$dataCurrentCSVlineToRetry] ??= $poolRetry[$rollingPoolIndexRetry % $currentCpuCount]->start( 791 | $pk ? 'PATCH' : 'POST', 792 | $endpoint($baseUrl[$item['decodedDataString']->tokenindex], $basePath, $pk), 793 | $dataString, 794 | $headers, 795 | $timeout, 796 | $curlRetry, 797 | ); 798 | } elseif ($poolRetry[$rollingPoolIndexRetry % $currentCpuCount]->isTerminated()) { 799 | unset($poolRetry[$rollingPoolIndexRetry % $currentCpuCount]); // Recycle terminated PHP Fibers 800 | 801 | $poolRetry[$rollingPoolIndexRetry % $currentCpuCount] = new Fiber( 802 | function ( 803 | string $givenHttpVerb, 804 | string $givenEndpoint, 805 | string $givenDataString, 806 | array $givenHeaders, 807 | int $givenTimeout, 808 | CurlHandle $givenTransport, 809 | ) use ($process, $combinedHttpResponse, $dataCurrentCSVlineToRetry): void { 810 | $combinedHttpResponse[$dataCurrentCSVlineToRetry] ??= $process( 811 | $givenHttpVerb, 812 | $givenEndpoint, 813 | $givenDataString, 814 | $givenHeaders, 815 | $givenTimeout, 816 | $givenTransport, 817 | ); 818 | $args = Fiber::suspend( 819 | $combinedHttpResponse[$dataCurrentCSVlineToRetry], 820 | ); 821 | $combinedHttpResponse[$dataCurrentCSVlineToRetry] ??= $process(...$args); 822 | }, 823 | ); 824 | 825 | $combinedHttpResponse[$dataCurrentCSVlineToRetry] ??= $poolRetry[$rollingPoolIndexRetry % $currentCpuCount]->start( 826 | $pk ? 'PATCH' : 'POST', 827 | $endpoint($baseUrl[$item['decodedDataString']->tokenindex], $basePath, $pk), 828 | $dataString, 829 | $headers, 830 | $timeout, 831 | $curlRetry, 832 | ); 833 | } 834 | 835 | // While overall script is not finished or PHP Fibers pool not empty 836 | while (!$poolRetry[$rollingPoolIndexRetry % $currentCpuCount]->isTerminated()) { 837 | $poolRetry[$rollingPoolIndexRetry % $currentCpuCount]->resume( 838 | [ 839 | $pk ? 'PATCH' : 'POST', 840 | $endpoint($baseUrl[$item['decodedDataString']->tokenindex], $basePath, $pk), 841 | $dataString, 842 | $headers, 843 | $timeout, 844 | $curlRetry, 845 | ], 846 | ); 847 | 848 | $decodedJsonOutputRetry = json_decode( 849 | $combinedHttpResponse[$dataCurrentCSVlineToRetry], 850 | false, 851 | 512, 852 | JSON_THROW_ON_ERROR, 853 | ); 854 | // don't show errors, handle them gracefully 855 | if (isset($decodedJsonOutputRetry->errors)) { 856 | continue; 857 | } 858 | if (isset($decodedJsonOutputRetry->data->attributes) && !isset($successfulCsvLines[$dataCurrentCSVlineToRetry])) { 859 | if ($silent == 1) { 860 | $successfulCsvLines[$dataCurrentCSVlineToRetry] = sprintf( 861 | '%s Deployed to: %s, CSV Line: %d, id: %d, created: %s, title: %s, alias: %s%s%s', 862 | ANSI_COLOR_GREEN, 863 | $item['decodedDataString']->tokenindex, 864 | $dataCurrentCSVlineToRetry, 865 | $decodedJsonOutputRetry->data->id, 866 | $decodedJsonOutputRetry->data->attributes->created, 867 | $decodedJsonOutputRetry->data->attributes->title, 868 | $decodedJsonOutputRetry->data->attributes->alias, 869 | ANSI_COLOR_NORMAL, 870 | CUSTOM_LINE_END, 871 | ); 872 | $enqueueMessage($successfulCsvLines[$dataCurrentCSVlineToRetry]); 873 | } 874 | } 875 | if ($isDone) { 876 | break; 877 | } 878 | } 879 | if (!$isDone) { 880 | ++$rollingPoolIndexRetry; // Important for circular pool of PHP Fibers 881 | } 882 | } 883 | } catch (DomainException $domainException) { 884 | throw $domainException; 885 | } catch (Throwable $e) { 886 | if ($silent == 1) { 887 | $failedCsvLines[$dataCurrentCSVlineToRetry] = sprintf( 888 | '%s Error message: %s, Error code line: %d, Error CSV Line: %d%s%s', 889 | ANSI_COLOR_RED, 890 | $e->getMessage(), 891 | $e->getLine(), 892 | $dataCurrentCSVlineToRetry, 893 | ANSI_COLOR_NORMAL, 894 | CUSTOM_LINE_END, 895 | ); 896 | $enqueueMessage($failedCsvLines[$dataCurrentCSVlineToRetry], 'error'); 897 | } 898 | continue; 899 | } finally { 900 | if (isset($curlRetry) && ($curlRetry instanceof CurlHandle)) { 901 | curl_close($curlRetry); 902 | } 903 | } 904 | } 905 | } catch (DomainException $domainException) { 906 | if ($silent == 1) { 907 | $enqueueMessage($domainException->getMessage()); 908 | } 909 | } catch (Throwable $fallbackCatchAllUncaughtException) { 910 | // Ignore silent mode when stumbling upon fallback exception 911 | $enqueueMessage( 912 | sprintf( 913 | '%s Error message: %s, Error code line: %d%s%s', 914 | ANSI_COLOR_RED, 915 | $fallbackCatchAllUncaughtException->getMessage(), 916 | $fallbackCatchAllUncaughtException->getLine(), 917 | ANSI_COLOR_NORMAL, 918 | CUSTOM_LINE_END, 919 | ), 920 | 'error', 921 | ); 922 | } finally { 923 | $isDone = true; 924 | 925 | // Cleanup references 926 | unset($pool); 927 | unset($poolOutput); 928 | 929 | if (in_array($saveReportToFile, [1, 2], true)) { 930 | $errors = []; 931 | $success = []; 932 | if (!file_exists(CSV_PROCESSING_REPORT_FILEPATH)) { 933 | touch(CSV_PROCESSING_REPORT_FILEPATH); 934 | } 935 | if (!empty($failedCsvLines)) { 936 | $errors = ['errors' => $failedCsvLines]; 937 | if ($saveReportToFile === 2) { 938 | file_put_contents(CSV_PROCESSING_REPORT_FILEPATH, json_encode($errors)); 939 | } 940 | } 941 | if (($saveReportToFile === 1) && !empty($successfulCsvLines)) { 942 | $success = ['success' => $successfulCsvLines]; 943 | file_put_contents(CSV_PROCESSING_REPORT_FILEPATH, json_encode(array_merge($errors, $success))); 944 | } 945 | } 946 | 947 | $enqueueMessage(sprintf('Done%s', CUSTOM_LINE_END)); 948 | } 949 | -------------------------------------------------------------------------------- /using-raw-php/smart-add-edit-with-subform-custom-field-support-from-streamed-csv-url.php: -------------------------------------------------------------------------------- 1 | 0 in csv it's doing a PATCH. If alias exists it add a random slug at the end of your alias and do PATCH again 8 | * - Now supports: 9 | * - subform custom fields in article 10 | * - images: intro / fulltext images in article 11 | * - urls: urla,urlb,urlc in article 12 | * @author Alexandre ELISÉ 13 | * @copyright (c) 2009 - present. Alexandre ELISÉ. All rights reserved. 14 | * @license GNU Affero General Public License version 3 (AGPLv3) 15 | * @link https://apiadept.com 16 | */ 17 | 18 | // Public url of the sample csv used in this example (CHANGE WITH YOUR OWN CSV URL IF YOU WISH) 19 | $csvUrl = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vTtV7Bnj-E3mwnBgXbkZlzS476aHVp6vtZ7qdI5vxlPUUqNe_85S3ozT5_gzNkBDih4dL1f8uDeeh_g/pub?gid=522567559&single=true&output=csv'; 20 | 21 | // Your Joomla! 4.x website base url 22 | $baseUrl = ''; 23 | // Your Joomla! 4.x Api Token (DO NOT STORE IT IN YOUR REPO USE A VAULT OR A PASSWORD MANAGER) 24 | $token = ''; 25 | $basePath = 'api/index.php/v1'; 26 | 27 | 28 | // Request timeout 29 | $timeout = 10; 30 | 31 | // Add custom fields support (shout-out to Marc DECHÈVRE : CUSTOM KING) 32 | // The keys are the columns in the csv with the custom fields names (that's how Joomla! Web Services Api work as of today) 33 | // For the custom fields to work they need to be added in the csv and to exists in the Joomla! site. 34 | $customFieldKeys = ['']; //['with-coffee','with-dessert','extra-water-bottle']; 35 | 36 | 37 | // This time we need endpoint to be a function to make it more dynamic 38 | $endpoint = fn(string $givenBaseUrl, string $givenBasePath, int $givenResourceId = 0): string => $givenResourceId ? sprintf('%s/%s/%s/%d', $givenBaseUrl, $givenBasePath, 'content/articles', $givenResourceId) 39 | : sprintf('%s/%s/%s', $givenBaseUrl, $givenBasePath, 'content/articles'); 40 | 41 | // PHP Generator to efficiently read the csv file 42 | $generator = function (string $url, array $keys = []): Generator { 43 | 44 | if (empty($url)) 45 | { 46 | yield new RuntimeException('Url MUST NOT be empty', 422); 47 | } 48 | 49 | $defaultKeys = [ 50 | 'id', 51 | 'title', 52 | 'alias', 53 | 'catid', 54 | 'articletext', 55 | 'introtext', 56 | 'fulltext', 57 | 'language', 58 | 'metadesc', 59 | 'metakey', 60 | 'state', 61 | 'featured', 62 | 'publish_up', 63 | 'publish_down', 64 | 'featured_up', 65 | 'featured_down', 66 | 'images', 67 | 'urls', 68 | ]; 69 | 70 | $mergedKeys = array_unique(array_merge($defaultKeys, $keys)); 71 | 72 | // Assess robustness of the code by trying random key order 73 | //shuffle($mergedKeys); 74 | 75 | $resource = fopen($url, 'r'); 76 | 77 | if ($resource === false) 78 | { 79 | yield new RuntimeException('Could not read csv file', 500); 80 | } 81 | 82 | try 83 | { 84 | //NON-BLOCKING I/O (Does not wait before processing next line.) 85 | stream_set_blocking($resource, false); 86 | 87 | $firstLine = stream_get_line( 88 | $resource, 89 | 0, 90 | "\r\n" 91 | ); 92 | 93 | if (empty($firstLine)) 94 | { 95 | yield new RuntimeException('First line MUST NOT be empty. It is the header', 422); 96 | } 97 | 98 | $csvHeaderKeys = str_getcsv($firstLine); 99 | $commonKeys = array_intersect($csvHeaderKeys, $mergedKeys); 100 | 101 | do 102 | { 103 | $currentLine = stream_get_line( 104 | $resource, 105 | 0, 106 | "\r\n" 107 | ); 108 | 109 | if (empty($currentLine)) 110 | { 111 | yield new RuntimeException('Current line MUST NOT be empty', 422); 112 | } 113 | 114 | $extractedContent = str_getcsv($currentLine); 115 | 116 | // Allow using csv keys in any order 117 | $commonValues = array_intersect_key($extractedContent, $commonKeys); 118 | 119 | // Iteration on leafs AND nodes 120 | $handleComplexValues = []; 121 | $iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($commonValues), RecursiveIteratorIterator::CATCH_GET_CHILD); 122 | foreach ($iterator as $key => $value) 123 | { 124 | if (json_decode($value) === false) 125 | { 126 | $handleComplexValues[$key] = json_encode($value); 127 | } 128 | else 129 | { 130 | $handleComplexValues[$key] = $value; 131 | } 132 | echo 'current item key: ' . $key . ' with value ' . $handleComplexValues[$key] . PHP_EOL; 133 | } 134 | 135 | $encodedContent = json_encode(array_combine($commonKeys, $handleComplexValues)); 136 | if ($encodedContent !== false) 137 | { 138 | yield $encodedContent; 139 | } 140 | 141 | yield new RuntimeException('Current line seem to be invalid', 422); 142 | } while (!feof($resource)); 143 | } finally 144 | { 145 | fclose($resource); 146 | } 147 | }; 148 | 149 | // Process data returned by the PHP Generator 150 | $process = function (string $givenHttpVerb, string $endpoint, string $dataString, array $headers, int $timeout, $transport) { 151 | curl_setopt_array($transport, [ 152 | CURLOPT_URL => $endpoint, 153 | CURLOPT_RETURNTRANSFER => true, 154 | CURLOPT_ENCODING => 'utf-8', 155 | CURLOPT_MAXREDIRS => 10, 156 | CURLOPT_TIMEOUT => $timeout, 157 | CURLOPT_FOLLOWLOCATION => true, 158 | CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_2TLS, 159 | CURLOPT_CUSTOMREQUEST => $givenHttpVerb, 160 | CURLOPT_POSTFIELDS => $dataString, 161 | CURLOPT_HTTPHEADER => $headers, 162 | ] 163 | ); 164 | 165 | $response = curl_exec($transport); 166 | // Continue even on partial failure 167 | if (empty($response)) 168 | { 169 | throw new RuntimeException('Empty output', 422); 170 | } 171 | 172 | return $response; 173 | }; 174 | // Read CSV in a PHP Generator using streams in non-blocking I/O mode 175 | $streamCsv = $generator($csvUrl, $customFieldKeys); 176 | $storage = []; 177 | foreach ($streamCsv as $dataKey => $dataString) 178 | { 179 | if (!is_string($dataString)) 180 | { 181 | continue; 182 | } 183 | $curl = curl_init(); 184 | try 185 | { 186 | // HTTP request headers 187 | $headers = [ 188 | 'Accept: application/vnd.api+json', 189 | 'Content-Type: application/json', 190 | 'Content-Length: ' . mb_strlen($dataString), 191 | sprintf('X-Joomla-Token: %s', trim($token)), 192 | ]; 193 | $decodedDataString = json_decode($dataString, true); 194 | // Article primary key. Usually 'id' 195 | $pk = (int) $decodedDataString['id']; 196 | $output = $process($pk ? 'PATCH' : 'POST', $endpoint($baseUrl, $basePath, $pk), $dataString, $headers, $timeout, $curl); 197 | 198 | $decodedJsonOutput = json_decode($output, true); 199 | 200 | // don't show errors, handle them gracefully 201 | if (isset($decodedJsonOutput['errors'])) 202 | { 203 | // If article is potentially a duplicate (already exists with same alias) 204 | $storage[$dataKey] = ['mightExists' => $decodedJsonOutput['errors'][0]['code'] === 400, 'decodedDataString' => $decodedDataString]; 205 | continue; 206 | } 207 | echo $output . PHP_EOL; 208 | } 209 | catch (Throwable $e) 210 | { 211 | echo $e->getMessage() . PHP_EOL; 212 | continue; 213 | } finally 214 | { 215 | curl_close($curl); 216 | } 217 | } 218 | // Handle errors and retries 219 | foreach ($storage as $item) 220 | { 221 | $curl = curl_init(); 222 | try 223 | { 224 | if ($item['mightExists']) 225 | { 226 | $pk = (int) $item['decodedDataString']['id']; 227 | $item['decodedDataString']['alias'] = sprintf('%s-%s', $item['decodedDataString']['alias'], bin2hex(random_bytes(4))); 228 | // back to json string after changing alias 229 | $dataString = json_encode($item['decodedDataString']); 230 | 231 | // HTTP request headers 232 | $headers = [ 233 | 'Accept: application/vnd.api+json', 234 | 'Content-Type: application/json', 235 | 'Content-Length: ' . mb_strlen($dataString), 236 | sprintf('X-Joomla-Token: %s', trim($token)), 237 | ]; 238 | 239 | $output = $process($pk ? 'PATCH' : 'POST', $endpoint($baseUrl, $basePath, $pk), $dataString, $headers, $timeout, $curl); 240 | echo $output . PHP_EOL; 241 | } 242 | } 243 | catch (Throwable $e) 244 | { 245 | echo $e->getMessage() . PHP_EOL; 246 | continue; 247 | } finally 248 | { 249 | curl_close($curl); 250 | } 251 | } 252 | -------------------------------------------------------------------------------- /using-raw-php/smart-add-or-edit-joomla-articles-from-streamed-csv-url.php: -------------------------------------------------------------------------------- 1 | 0 in csv it's doing a PATCH. If alias exists it add a random slug at the end of your alias and do PATCH again 8 | * 9 | * @author Alexandre ELISÉ 10 | * @copyright (c) 2009 - present. Alexandre ELISÉ. All rights reserved. 11 | * @license GNU Affero General Public License version 3 (AGPLv3) 12 | * @link https://apiadept.com 13 | */ 14 | 15 | // Public url of the sample csv used in this example (CHANGE WITH YOUR OWN CSV URL IF YOU WISH) 16 | $csvUrl = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vTtV7Bnj-E3mwnBgXbkZlzS476aHVp6vtZ7qdI5vxlPUUqNe_85S3ozT5_gzNkBDih4dL1f8uDeeh_g/pub?gid=522567559&single=true&output=csv'; 17 | 18 | // Your Joomla! 4.x website base url 19 | $baseUrl = ''; 20 | // Your Joomla! 4.x Api Token (DO NOT STORE IT IN YOUR REPO USE A VAULT OR A PASSWORD MANAGER) 21 | $token = ''; 22 | $basePath = 'api/index.php/v1'; 23 | 24 | 25 | // Request timeout 26 | $timeout = 10; 27 | 28 | // Add custom fields support (shout-out to Marc DECHÈVRE : CUSTOM KING) 29 | // The keys are the columns in the csv with the custom fields names (that's how Joomla! Web Services Api work as of today) 30 | // For the custom fields to work they need to be added in the csv and to exists in the Joomla! site. 31 | $customFieldKeys = []; //['with-coffee','with-dessert','extra-water-bottle']; 32 | 33 | 34 | // This time we need endpoint to be a function to make it more dynamic 35 | $endpoint = fn(string $givenBaseUrl, string $givenBasePath, int $givenResourceId = 0): string => $givenResourceId ? sprintf('%s/%s/%s/%d', $givenBaseUrl, $givenBasePath, 'content/articles', $givenResourceId) 36 | : sprintf('%s/%s/%s', $givenBaseUrl, $givenBasePath, 'content/articles'); 37 | 38 | // PHP Generator to efficiently read the csv file 39 | $generator = function (string $url, array $keys = []): Generator { 40 | 41 | if (empty($url)) 42 | { 43 | yield new RuntimeException('Url MUST NOT be empty', 422); 44 | } 45 | 46 | $defaultKeys = [ 47 | 'id', 48 | 'title', 49 | 'alias', 50 | 'catid', 51 | 'articletext', 52 | 'introtext', 53 | 'fulltext', 54 | 'language', 55 | 'metadesc', 56 | 'metakey', 57 | 'state', 58 | 'featured', 59 | 'publish_up', 60 | 'publish_down', 61 | 'featured_up', 62 | 'featured_down', 63 | ]; 64 | 65 | $mergedKeys = array_unique(array_merge($defaultKeys, $keys)); 66 | 67 | // Assess robustness of the code by trying random key order 68 | //shuffle($mergedKeys); 69 | 70 | $resource = fopen($url, 'r'); 71 | 72 | if ($resource === false) 73 | { 74 | yield new RuntimeException('Could not read csv file', 500); 75 | } 76 | 77 | try 78 | { 79 | //NON-BLOCKING I/O (Does not wait before processing next line.) 80 | stream_set_blocking($resource, false); 81 | 82 | $firstLine = stream_get_line( 83 | $resource, 84 | 0, 85 | "\r\n" 86 | ); 87 | 88 | if (empty($firstLine)) 89 | { 90 | yield new RuntimeException('First line MUST NOT be empty. It is the header', 422); 91 | } 92 | 93 | $csvHeaderKeys = str_getcsv($firstLine); 94 | $commonKeys = array_intersect($csvHeaderKeys, $mergedKeys); 95 | 96 | do 97 | { 98 | $currentLine = stream_get_line( 99 | $resource, 100 | 0, 101 | "\r\n" 102 | ); 103 | 104 | if (empty($currentLine)) 105 | { 106 | yield new RuntimeException('Current line MUST NOT be empty', 422); 107 | } 108 | 109 | $extractedContent = str_getcsv($currentLine); 110 | 111 | // Allow using csv keys in any order 112 | $commonValues = array_intersect_key($extractedContent, $commonKeys); 113 | 114 | $encodedContent = json_encode(array_combine($commonKeys, $commonValues)); 115 | if ($encodedContent !== false) 116 | { 117 | yield $encodedContent; 118 | } 119 | 120 | yield new RuntimeException('Current line seem to be invalid', 422); 121 | } while (!feof($resource)); 122 | } finally 123 | { 124 | fclose($resource); 125 | } 126 | }; 127 | 128 | // Process data returned by the PHP Generator 129 | $process = function (string $givenHttpVerb, string $endpoint, string $dataString, array $headers, int $timeout, $transport) { 130 | curl_setopt_array($transport, [ 131 | CURLOPT_URL => $endpoint, 132 | CURLOPT_RETURNTRANSFER => true, 133 | CURLOPT_ENCODING => 'utf-8', 134 | CURLOPT_MAXREDIRS => 10, 135 | CURLOPT_TIMEOUT => $timeout, 136 | CURLOPT_FOLLOWLOCATION => true, 137 | CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_2TLS, 138 | CURLOPT_CUSTOMREQUEST => $givenHttpVerb, 139 | CURLOPT_POSTFIELDS => $dataString, 140 | CURLOPT_HTTPHEADER => $headers, 141 | ] 142 | ); 143 | 144 | $response = curl_exec($transport); 145 | // Continue even on partial failure 146 | if (empty($response)) 147 | { 148 | throw new RuntimeException('Empty output', 422); 149 | } 150 | 151 | return $response; 152 | }; 153 | // Read CSV in a PHP Generator using streams in non-blocking I/O mode 154 | $streamCsv = $generator($csvUrl, $customFieldKeys); 155 | $storage = []; 156 | foreach ($streamCsv as $dataKey => $dataString) 157 | { 158 | if (!is_string($dataString)) 159 | { 160 | continue; 161 | } 162 | $curl = curl_init(); 163 | try 164 | { 165 | // HTTP request headers 166 | $headers = [ 167 | 'Accept: application/vnd.api+json', 168 | 'Content-Type: application/json', 169 | 'Content-Length: ' . mb_strlen($dataString), 170 | sprintf('X-Joomla-Token: %s', trim($token)), 171 | ]; 172 | $decodedDataString = json_decode($dataString, true); 173 | // Article primary key. Usually 'id' 174 | $pk = (int) $decodedDataString['id']; 175 | $output = $process($pk ? 'PATCH' : 'POST', $endpoint($baseUrl, $basePath, $pk), $dataString, $headers, $timeout, $curl); 176 | 177 | $decodedJsonOutput = json_decode($output, true); 178 | 179 | // don't show errors, handle them gracefully 180 | if (isset($decodedJsonOutput['errors'])) 181 | { 182 | // If article is potentially a duplicate (already exists with same alias) 183 | $storage[$dataKey] = ['mightExists' => $decodedJsonOutput['errors'][0]['code'] === 400, 'decodedDataString' => $decodedDataString]; 184 | continue; 185 | } 186 | echo $output . PHP_EOL; 187 | } 188 | catch (Throwable $e) 189 | { 190 | echo $e->getMessage() . PHP_EOL; 191 | continue; 192 | } finally 193 | { 194 | curl_close($curl); 195 | } 196 | } 197 | // Handle errors and retries 198 | foreach ($storage as $item) 199 | { 200 | $curl = curl_init(); 201 | try 202 | { 203 | if ($item['mightExists']) 204 | { 205 | $pk = (int) $item['decodedDataString']['id']; 206 | $item['decodedDataString']['alias'] = sprintf('%s-%s', $item['decodedDataString']['alias'], bin2hex(random_bytes(4))); 207 | // back to json string after changing alias 208 | $dataString = json_encode($item['decodedDataString']); 209 | 210 | // HTTP request headers 211 | $headers = [ 212 | 'Accept: application/vnd.api+json', 213 | 'Content-Type: application/json', 214 | 'Content-Length: ' . mb_strlen($dataString), 215 | sprintf('X-Joomla-Token: %s', trim($token)), 216 | ]; 217 | 218 | $output = $process($pk ? 'PATCH' : 'POST', $endpoint($baseUrl, $basePath, $pk), $dataString, $headers, $timeout, $curl); 219 | echo $output . PHP_EOL; 220 | } 221 | } 222 | catch (Throwable $e) 223 | { 224 | echo $e->getMessage() . PHP_EOL; 225 | continue; 226 | } finally 227 | { 228 | curl_close($curl); 229 | } 230 | } 231 | -------------------------------------------------------------------------------- /using-raw-php/turn-your-top-5-favorite-movies-into-joomla-articles-omdb-api.php: -------------------------------------------------------------------------------- 1 | 0 it's doing a PATCH. If alias exists it add a random slug at the end of your alias and do PATCH again 8 | * 9 | * @author Alexandre ELISÉ 10 | * @copyright (c) 2009 - present. Alexandre ELISÉ. All rights reserved. 11 | * @license GNU Affero General Public License version 3 (AGPLv3) 12 | * @link https://apiadept.com 13 | */ 14 | 15 | // Your OMDb API Key (GET YOUR OWN here : https://www.omdbapi.com/apikey.aspx) 16 | $dataSourceToken = 'youromdbapikey'; 17 | // CHANGE TO YOUR OWN TOP 5 FAVOURITE MOVIES BY PUTTING THEIR IMDb id in the seeds array 18 | // Movies used in seed are: Steve Jobs 2015, The Matrix Reloaded, Good Will Hunting, The Man Who Knew Infinity, Finding Forrester 19 | $seeds = ['tt2080374', 'tt0234215', 'tt0119217', 'tt0787524', 'tt0181536']; 20 | $dataSourceEndpointImdbId = $seeds[random_int(0, (count($seeds) - 1))]; // 21 | //$dataSourceEndpointYear = 2019; // Year of the release of the item 22 | $dataSourceEndpointType = 'movie'; // 'movie', 'series', 'episode' 23 | $dataSourceEndpointPlot = 'short'; // 'short or 'full' 24 | $dataSourceEndpointVersion = 1; 25 | $dataSourceEndpointFormat = 'json'; // 'json' or 'xml' 26 | 27 | // Your Omdb API Endpoint Url 28 | $dataSourceUrl = sprintf('https://www.omdbapi.com/?apikey=%s&i=%s&type=%s&plot=%s&v=%d&r=%s', $dataSourceToken, $dataSourceEndpointImdbId, $dataSourceEndpointType, $dataSourceEndpointPlot, $dataSourceEndpointVersion, $dataSourceEndpointFormat); 29 | 30 | // Your Joomla! 4.x website base url 31 | $baseUrl = [ 32 | 'app-001' => 'https://app-001.example.org', 33 | 'app-002' => 'https://app-002.example.org', 34 | 'app-003' => 'https://app-003.example.org', 35 | ]; 36 | // Your Joomla! 4.x Api Token (DO NOT STORE IT IN YOUR REPO USE A VAULT OR A PASSWORD MANAGER) 37 | $token = [ 38 | 'app-001' => 'yourapp001joomlaapitoken', 39 | 'app-002' => 'yourapp002joomlaapitoken', 40 | 'app-003' => 'yourapp003joomlaapitoken', 41 | ]; 42 | $basePath = 'api/index.php/v1'; 43 | 44 | // Request timeout 45 | $timeout = 10; 46 | 47 | // PHP Generator to efficiently process Omdb Movie Api response 48 | $generator = function (string $dataSourceResponse, array $appIndexes): Generator { 49 | 50 | if (empty($dataSourceResponse)) 51 | { 52 | yield new RuntimeException('Omdb Movie Api response MUST NOT be empty', 422); 53 | } 54 | 55 | $defaultKeys = [ 56 | 'id', 57 | 'access', 58 | 'title', 59 | 'alias', 60 | 'catid', 61 | 'articletext', 62 | 'introtext', 63 | 'fulltext', 64 | 'language', 65 | 'metadesc', 66 | 'metakey', 67 | 'state', 68 | 'featured', 69 | 'images', 70 | 'urls', 71 | 'tokenindex', 72 | ]; 73 | 74 | // Assess robustness of the code by trying random key order 75 | //shuffle($mergedKeys); 76 | 77 | $resource = json_decode($dataSourceResponse); 78 | 79 | if ($resource === false) 80 | { 81 | yield new RuntimeException('Could not read response', 500); 82 | } 83 | 84 | try 85 | { 86 | 87 | $id = 0; 88 | $title = $resource->Title; 89 | $alias = ''; 90 | $catid = 2; 91 | $language = '*'; 92 | $metadesc = ''; 93 | $metakey = ''; 94 | $state = 1; 95 | $featured = 0; 96 | $access = 1; 97 | 98 | 99 | //choosen random tokenindex to deploy result to random url matched by this tokenindex 100 | $tokenindex = array_rand($appIndexes); 101 | 102 | $poster = $resource->Poster; 103 | 104 | $images = <<Plot; 113 | 114 | $contentList = ''; 115 | foreach ($resource as $key => $value) 116 | { 117 | if (in_array($key, ['Title', 'Plot', 'Poster', 'Ratings', 'Response',], true)) 118 | { 119 | continue; 120 | } 121 | $contentList .= sprintf('

    %s : %s

    ', $key, $value); 122 | } 123 | 124 | $ratingList = ''; 125 | foreach ($resource->Ratings as $rating) 126 | { 127 | $ratingList .= sprintf('
  • %s
    %s
  • ', $rating->Source, $rating->Value); 128 | } 129 | 130 | $fulltext = <<Here is what we know about this movie according to ImDb

    132 | $contentList 133 |
      134 | $ratingList 135 |
    136 | HTML; 137 | $articletext = << 140 | $fulltext 141 | HTML; 142 | 143 | yield json_encode( 144 | array_combine( 145 | $defaultKeys, 146 | [ 147 | $id, 148 | $access, 149 | $title, 150 | $alias, 151 | $catid, 152 | $articletext, 153 | $introtext, 154 | $fulltext, 155 | $language, 156 | $metadesc, 157 | $metakey, 158 | $state, 159 | $featured, 160 | json_decode(str_replace(["\n", "\r", "\t"], '', trim($images))), 161 | json_decode(str_replace(["\n", "\r", "\t"], '', trim($urls))), 162 | $tokenindex, 163 | ] 164 | ) 165 | ); 166 | } finally 167 | { 168 | echo 'DONE processing data' . PHP_EOL; 169 | } 170 | }; 171 | 172 | // This time we need endpoint to be a function to make it more dynamic 173 | $endpoint = function (string $givenBaseUrl, string $givenBasePath, int $givenResourceId = 0): string { 174 | return $givenResourceId ? sprintf('%s/%s/%s/%d', $givenBaseUrl, $givenBasePath, 'content/articles', $givenResourceId) 175 | : sprintf('%s/%s/%s', $givenBaseUrl, $givenBasePath, 'content/articles'); 176 | }; 177 | 178 | // Process data returned by the PHP Generator 179 | $process = function (string $givenHttpVerb, string $endpoint, string $dataString, array $headers, int $timeout, $transport) { 180 | curl_setopt_array($transport, [ 181 | CURLOPT_URL => $endpoint, 182 | CURLOPT_RETURNTRANSFER => true, 183 | CURLOPT_ENCODING => 'utf-8', 184 | CURLOPT_MAXREDIRS => 10, 185 | CURLOPT_TIMEOUT => $timeout, 186 | CURLOPT_FOLLOWLOCATION => true, 187 | CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2, 188 | CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_2TLS, 189 | CURLOPT_CUSTOMREQUEST => $givenHttpVerb, 190 | CURLOPT_POSTFIELDS => $dataString, 191 | CURLOPT_HTTPHEADER => $headers, 192 | ] 193 | ); 194 | 195 | $response = curl_exec($transport); 196 | // Continue even on partial failure 197 | if (empty($response)) 198 | { 199 | throw new RuntimeException('Empty output', 422); 200 | } 201 | 202 | return $response; 203 | }; 204 | 205 | // Omdb Api response (First call to GET items) 206 | $dataSourceHttpVerb = 'GET'; 207 | 208 | $dataSourceDataString = ''; 209 | 210 | $dataSourceHeaders = [ 211 | 'Accept: application/json', 212 | 'Accept-Encoding: deflate, gzip, br', 213 | 'Content-Type: application/json', 214 | 'Connection: keep-alive', 215 | 'User-Agent: Alexeli/1.0.0', 216 | ]; 217 | $dataSourceTimeout = 1; 218 | 219 | $dataSourceTransport = curl_init(); 220 | try 221 | { 222 | $dataSourceResponse = $process($dataSourceHttpVerb, $dataSourceUrl, $dataSourceDataString, $dataSourceHeaders, $dataSourceTimeout, $dataSourceTransport); 223 | $streamData = $generator($dataSourceResponse, $baseUrl); 224 | 225 | $storage = []; 226 | foreach ($streamData as $dataString) 227 | { 228 | if (!is_string($dataString)) 229 | { 230 | continue; 231 | } 232 | $curl = curl_init(); 233 | try 234 | { 235 | $decodedDataString = json_decode($dataString); 236 | if ($decodedDataString === false) 237 | { 238 | continue; 239 | } 240 | 241 | // HTTP request headers 242 | $headers = [ 243 | 'Accept: application/vnd.api+json', 244 | 'Content-Type: application/json', 245 | 'Content-Length: ' . mb_strlen($dataString), 246 | sprintf('X-Joomla-Token: %s', trim($token[$decodedDataString->tokenindex])), 247 | ]; 248 | 249 | // Article primary key. Usually 'id' 250 | $pk = (int) $decodedDataString->id; 251 | $output = $process($pk ? 'PATCH' : 'POST', $endpoint($baseUrl[$decodedDataString->tokenindex], $basePath, $pk), $dataString, $headers, $timeout, $curl); 252 | 253 | $decodedJsonOutput = json_decode($output); 254 | 255 | // don't show errors, handle them gracefully 256 | if (isset($decodedJsonOutput->errors)) 257 | { 258 | // If article is potentially a duplicate (already exists with same alias) 259 | $storage[] = ['mightExists' => $decodedJsonOutput->errors[0]->code === 400, 'decodedDataString' => $decodedDataString]; 260 | continue; 261 | } 262 | echo $output . PHP_EOL; 263 | } 264 | catch (Throwable $streamDataThrowable) 265 | { 266 | echo $streamDataThrowable->getMessage() . PHP_EOL; 267 | continue; 268 | } finally 269 | { 270 | curl_close($curl); 271 | } 272 | } 273 | // Handle errors and retries 274 | foreach ($storage as $item) 275 | { 276 | $storageCurl = curl_init(); 277 | try 278 | { 279 | if ($item['mightExists']) 280 | { 281 | $pk = (int) $item['decodedDataString']->id; 282 | $item['decodedDataString']->alias = sprintf('%s-%s', $item['decodedDataString']->alias, bin2hex(random_bytes(4))); 283 | // No need to do another json_encode anymore 284 | $dataString = json_encode($item['decodedDataString']); 285 | // HTTP request headers 286 | $headers = [ 287 | 'Accept: application/vnd.api+json', 288 | 'Content-Type: application/json', 289 | 'Content-Length: ' . mb_strlen($dataString), 290 | sprintf('X-Joomla-Token: %s', trim($token[$item['decodedDataString']->tokenindex])), 291 | ]; 292 | $output = $process($pk ? 'PATCH' : 'POST', $endpoint($baseUrl[$item['decodedDataString']->tokenindex], $basePath, $pk), $dataString, $headers, $timeout, $storageCurl); 293 | echo $output . PHP_EOL; 294 | } 295 | } 296 | catch (Throwable $storageThrowable) 297 | { 298 | echo $storageThrowable->getMessage() . PHP_EOL; 299 | continue; 300 | } finally 301 | { 302 | curl_close($storageCurl); 303 | } 304 | } 305 | } 306 | catch (Throwable $e) 307 | { 308 | echo $e->getMessage() . PHP_EOL; 309 | } finally 310 | { 311 | curl_close($dataSourceTransport); 312 | } 313 | --------------------------------------------------------------------------------