Hi,
I’m working on connecting Contentful to an app I’m building in PlayCanvas (using javascript).
I’ve got everything working perfectly using the Delivery API. I’m having trouble getting it to connect to the Management API though.
In PlayCanvas there’s a section to include links to external script files. I’m using the following links from the installation instruction on GitHub:
Delivery
https://cdn.jsdelivr.net/npm/contentful@latest/dist/contentful.browser.min.js
Management
https://cdn.jsdelivr.net/npm/contentful-management@latest/dist/contentful-management.browser.min.js
It feels like having both scripts included is causing some conflicts so I stripped out everything related to content delivery as a test.
Using only the following code and the gives me an error:
Uncaught ReferenceError: contentful is not defined
this.cmaClient = contentful.createClient({
accessToken: this.ManagementToken
});
‘this.ManagementToken’ is a variable set up using the personal access token I generated in the contentful web app. It makes no difference if I paste the token in directly.
This code works with the CDA, but not the CMA. What am I doing wrong?
Best practices question - My app both receives data and updates entries (never creating, just updating) should I use the CMA for everything, or CDA when receiving and CMA when sending. Hopefully that question makes sense.
Thank you!