Add content from external api to Contentful - contentful

Is it possible to add content from a external api to Contentful headless-cms?
Let's say I create a content type "product-feed" which enables the author to filter products from our shop backend. Therefore it should be possible to retrieve categories, brands, etc from our shop api.

Yes, it is possible. You'd have to build your own custom ui-extension. It is a small html + javascript app that you upload to Contentful that would talk to your backend api and display your products etc. in the Contentful UI.
You can see several examples and code here: https://www.contentful.com/developers/docs/extensibility/ui-extensions/

Related

SharePoint API: Create a page with custom HTML on a communications site

I need to create a new page on a SharePoint Communications Site programmatically, using the SharePoint APIs. The URL of this site looks like this: https://[sharepoint url]/sites/KnowledgeBase
And this is basically what I'm trying to do:
I am able to make authenticated requests to SharePoint using the REST API. I have that working in Postman. Unfortunately, I can't find any reliable documentation or a tutorial on how to create a new (modern) page with custom HTML content, using the REST API.
I was able to find this documentation on creating a page with the Graph API. However, I'm not sure if the Graph API is the right option, since it is still in beta, and the integration I'm building will go into Production.
Any help or insight on how to do this, and which API to use, would be really appreciated.
You could use Microsoft pnpjs library to simplify your life (it wraps the REST API), it has built-in support for client-side pages:
const sp = spfi(...);
// simplest add a page example
const page = await sp.web.addClientsidePage("mypage1");
https://pnp.github.io/pnpjs/sp/webs/#client-side-pages

Reading product metafields through Shopify ScriptTag API

I'm building a Shopify embedded application with two main points of functionality:
Upon install, product meta fields are populated with some values
Upon page load, a custom script is injected into product page through shopify ScriptTag api
The injected script displays some icon alongside the values from product meta fields.
Currently, from the product page, the injected script is having to request the meta fields from my local server, which then queries the clients shopify for before sending back the response.
Is there a way to access the meta field values directly from the product page, without having to do the above?
Thanks in advance.
The injected script only fires at page load on frontend, while accessing metafields is only possible via Liquid or Shopify API. The data flow that you have right now is the standard way of doing things in Shopify in such cases. However, considering performance implications or for whatever reasons, if you still want to achieve this, you can make use of Liquid.
Doing so can be done in 2 ways.
Provide a Liquid code snippet
Use Shopify API to add Liquid code snippet on App installation
Liquid Code Snippet
Once a user installs your app, provide them a Liquid code snippet to integrate in to their theme. That liquid code snippet should expose the Meta Fields to some JavaScript variable, that your injected script will read.
Shopify API to add Liquid code snippet
If you don't want the users to integrate the Liquid code snippet manually, then on Application install, make use of Theme Assets API to add you Liquid code snippet to the clients' active theme. This will need additional App permissions from users on install. Also factor in different available themes and removing code snippet from theme when App is uninstalled.
You haven't mentioned the resource where you will be creating metafields, but sample Liquid code snippet should look something like
<script>
var customMetaField = {shop.metafields.namespace.fieldname}
</script>
In your custom App script read the variable customMetaField. This is just a rough idea, you will need to check if the metafield namespace and the metafields exist and then output the values accordingly.
Shop Metafields

Kentico based content in pardot

I have some CTAs based on a custom page type. I'm wondering if there is a way to get a json object so i can consume that in some JS on a pardot landing page i'm building out?
I'd like to avoid cutting and pasting the rendered HTML as I know these will change.
Are you aware of our REST services?
https://docs.kentico.com/k10/integrating-3rd-party-systems/kentico-rest-service/getting-data-using-rest/examples-of-data-retrieved-via-the-rest-service#ExamplesofdataretrievedviatheRESTservice-JSON
On the other hand, if REST is overkill for you you can take advantage of the Custom Response web part and return just the JSON you need or possibly this custom web part:
http://devnet.kentico.com/articles/custom-response-repeater

Sail.js - how to structure JSON based live data output with existing static data in the model

In my Angular app, I want to display a table which contains the following
a) URL
b) Social share counts divided by different social networks
Using Sails.js, I already have the api created for the URL when the results show up, I can display the URL now I'm confused how to get the appropriate social counts showing right besides
Here's the API I'm using: https://docs.sharedcount.com/
by itself, I can see the JSON it produces
But here are my questions:
Should I create a new api (model/controller) for social count data or include it in my model where I have the 'url' action defined?
If I create a new api or include the social_counts as an action in the current, what would my JSON query look like? to retrieve the URL's, I'm using default API blueprint that Sails provides, so:
http://www.example.com/url/find?where={"title":{"contains":"mark"}}
Struggling a bit in terms of the thought process, would be great to get input on this
It depends on your app. is your app will store that data or just consume it? If it need to store, of course you need the API. In purpose for modification or aggregating the data for example.
No, you can't do that. That shortcut method only works if you have the data in your database and let the Sails Waterline ORM and Blueprint API served it.
Perhaps, if you only need to consume the data from that Sharedcount API, you didn't need to use Sails as a backend, in this context. Just use Angular as a client of that API. Except if you need to modify the data first and store it in your own database, so Sails will helps with it's Waterline ORM and Blueprint API.

search engines index html5 web application with nodejs backend

I'm building an html5 web application with knockoutjs + backend rest service in nodejs (custom rest api, I'm not using express and i deliver only json data - no html).
The application is working fine like it is, but I need to get indexed by google.
I populate content using ajax requests and now i need to find a solution to make those pages "visible" for search engines.
Is there any true elegant solution for this? I don't want to make another backend service(website - expressjs or php etc)
Please advice :|
Google specifies a way for your site to provide "HTML snapshots" of ajax-loaded content. Not sure how well this works or if other search engines support it.
https://developers.google.com/webmasters/ajax-crawling/docs/getting-started

Resources