There are many aspects to Googlebase. We here discuss how to upload or get your data (aka feed) into googlebase; in fact we concentrate on automating the upload via ftp.
Quick Overview of Googlebase Feed Update
Googlebase implementation allows you to get your feed into its system and update the feed afterwards by manual upload (from the broswer, click upload file), or by setting up a feed schedule (Googlebase will automatically "pull" your feed at scheduled times), or by running ftp sessions to "push" your feed to Googlebase.
Definitely, the manual via-browser upload is not the way to go for anyone looking to automate the feed upload process. Both remaining methods a) scheduling upload via your googlebase dashboard (pull) and b) running ftp to upload the feed (push) are automated. Rather than asking which is better a) or b) it may be better to note that you will need to create/generate the data feed for both. Since you're likely generating the data with a script, then why not take the extra step to push it up to googlebase? Googlebase allows you to push up (upload) the feed with the ftp application protocol. The remainder of this document shows the ftp process.
1. Get the ftp access credential and server address
After you creat a Google Account and you login to the Merchant center, you need to request ftp access credentials - server access id and password
2.Create FTP commands set
Now use your favorite editor (vi, vim, gmacs, etc. on Linux/Unix cygwin) or notepad on Windows) to create a commands file for the ftp upload from your server to Google base server. Assume we name this file as feedldr.txt, the contents will be similar to the following
user ftp_userid ftp_passwd
binary
hash
put TheFeed.txt.gz
ls -l
bye
In the file (contents above),
-substitute the ftp_userid and ftp_passwd received from Step 1
-use binary when you're uploading a zip (binary) file, otherwise use ascii
-the hash is to show the prograss of the upload visually
-the put line is the actual command that "moves" your feed from your server to the Google base ftp staging area
-Immediately after the put, we want to be sure that the file is indeed upload so we do a listing of the destination directory (hopefully, the Google base processor has not removed the feed at this time)
-finally, we close the session with the bye command.
3. Run a Test UPload
Before completing the automation with a cron job (Linux) or Scheduled Task (Windows), run an instance of the task—the same task you are hoping to automate. Here is a sample command line to execute the task (on UNIX)
ftp -i -n -d ftp_server < feedldr.txt >logfile
where ftp_server is the server hostname obtained from Step 1, feedldr.txt is the file created in Step 2 and the ftp option -d asks ftp to report more detailed info, useful in case you need to determine later why your feed apparently failed.
Look in logfile after the run completes. Fix problems as needed. Once you can run the above command successfully the final step is to put the command in a regularly scheduled mode with crontab.
4. Install the Feed Upload Task in the cron System
Invoke cron with crontab -e to bring up the cron editor. Then insert
00 03 * * * ftp -i -n -d ftp_server < /var/dat/feedldr.txt >/var/logs/logfile
Save the edit; your Google base feed upload via ftp push is now automated and ready to upload everyday starting at 3:00 am. You may want to check cron man pages for more understanding of the crontab fields.
No comments:
Post a Comment