Created
October 2, 2019 00:47
-
-
Save manojnaidu619/8c4ef1108fd774c3097239072fb199d7 to your computer and use it in GitHub Desktop.
Contentful Ruby SDK usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'contentful' | |
client = Contentful::Client.new( | |
space: '<spacd_id>', | |
access_token: '<access-token>', | |
dynamic_entries: :auto | |
) | |
entries = client.entries # For grabbing entries | |
entries.each do |entry| | |
if entry.fields[:FieldName] | |
puts entry.fields[:FieldName] | |
end | |
end | |
assets = client.assets # For grabbing image data | |
assets.each do |asset| | |
puts asset.image_url | |
end | |
#Format of image_url : https://<asset.image_url> | |
# As a curl query parameter: | |
# curl -v https://cdn.contentful.com/spaces/<space_id>/entries?access_token=<access_token> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment