How to copy content from one space to other space in contenful? - contentful

I have created a new space in contentful. Now I want to copy all content model, content from old space to new created space to save my time.Please assist me how I can do that?

You can use the Contentful CLI for that. All the content can be exported to a JSON file which then can be imported into a new space.

Related

Create dummy content

Using a free Contentful account I've created a New Space and a Content model named Post. Each Post can have a variety of data types for field
and the one's I'm using are
title - Text (short)
subtitle - Text (short)
author - Text (short)
slug - Text (short)
image - Media
content - Rich text
Now, when it comes to the creation of content, I can add Posts manually by filling out the information in the following form and clicking the green button "Publish".
While this is ok if I'm creating one post, if I want to create 50 posts that'd take too long (even duplicating the Posts because they become Drafts and need to still be duplicated, slightly edited and published). How can this be automated?
Contentful DevRel here. 👋
To create a lot of entries and new data we provide the Content Management API (CMA). This API's purpose is to perform WRITE operations in your Contentful space.
One way to create hundreds of new entries you can use this WRITE API and write a custom script to create all of them.
For example in Node.js that could look like follows:
// Call this in a loop 👇
client.getSpace('<space_id>')
.then((space) => space.createEntryWithId('<content_type_id>', '<entry_id>', {
fields: {
title: {
'en-US': 'Entry title'
}
}
}))
.then((entry) => console.log(entry))
.catch(console.error)
If you don't want to define the ID yourself you can use createEntry. (I just figured the docs are missing that one and will fix it 🙈).
Another way to approach this would be to not use the "vanilla CMA". We provide tooling to e.g. import/export all the data that you have in your Contentful spaces. These tools of the ecosystem sit on top of the CMA and abstract the API calls away.
There is import/export tooling that you can use as a provided npm package or CLI tooling. This tools can be useful if you don't want to write a script in your programming language of choice.
What you could do is to export a space to a JSON file and then adjust the JSON file with the entries that you want to create. You could then use the import command to create a bulk of entries based on the JSON file.
contentful space export
# adjust the content file
contentful space import --content-file <file>
I hope that helps, let me know how it goes. :)

Asciidoctor: how to replace expression in included document?

Given asciidoctor file my-document.adoc with the content:
include::included-document.adoc[]
included-document.adoc contains
The content of this file cannot be changed.
This text *has to be replaced*.
When I render my-document.adoc, I want to have the visible content
The content of this file cannot be changed.
This text has successfully been replaced.
Is this possible without changing included-document.adoc? my-document.adoc may be changed.
There is an Asciidoctor extension lab that provides examples for this, for example an include processor that exchanges tabs for spaces.
I hope this gets you started.
https://github.com/asciidoctor/asciidoctor-extensions-lab/blob/master/lib/whitespace-include-processor.rb

Why do Domino store all my inline images in the xsppers folder?

Every time I reload my webpage new files are added to the c:\windows\temp\notes...\xsppers folder on the server. and these files are never deleted, I have to manually delete them, and it can be several GB of data to delete every month
I have a simple xpage with a repeat control that display data from several documents using a computed Field mapped to a rich text field.
the richtext fields contain a lot of inline images that has been added using the notes client.
Now, every time I reload my webpage these images are now detached to the xspper folder and is causing my harddrive to run out of disc space all the time.
What is the reason for this behaviour and how can I avoid it from happening?
In the image below you see all the gifs that has been created with a new uinque name, each time I reload my webpage a new set up images are added to the folder.
I am using Domino 9
As Egor Margineanu wrote, this can happen if your images are not stored as MIME images in your Rich Text item.
This forces the domino server to detach the attachment(s) over and over again to disc, because it is required to generate a GIF form the inline image. If you change the MIME type of your rich text item in your form and save the document(s) again, the images are stored in the "correct" format, and the domino server is able to identify that the images are already on the HDD.
As far I can see the temorarly detached attachments are not wiped when the session ends. This seems to happen if the application ends.
Not a complete answer but some clarification from the XPages Portable Command Guide, page 36:
The files remain in the temporary persistence location until the user
session expires. The file is not removed after the document is saved,
although it is no longer referenced by URLs.
It may be useful to change this
setting to point to a different location if the folder is taking up
too much space on the main server drive and another drive has more
available space. This option is server-wide, so it should be set in
the server xsp.properties file. Values set in a particular
application’s xsp.properties file are ignored.
Based on your question, Thomas, it seems that this is not what you are experiencing.

Dynamically creating PDF document with PSPDFKit

I am using PSPDFKit as an image editor.
How do I create a new PSPDFDocument with a certain width/height? Also, how do I dynamically add pages to PDPDFDocument?
Maybe the answer is that I need to dynamically create a blank PDF myself every time I want to edit an image. I was hoping it was built in.
You can both create new empty files and add/remove documents using PSPDFProcessor. Use the HTML conversion with an empty string to get a blank page; and the generatePDFFromDocument: methods to modify existing documents.

difference between data writing to existing file and copy entire content from another in C#

I have developed one windows application,which is checking for newly updated or generated file in a directory and copying the data to a temporary file.My application is doing its job perfectly.But,There is one third party application "POS Text Sender",which will read all the text from a temporary file and display on CCTV Camera if i use notepad text editor to copy data.But when my application does this work,POS Text Sender will read the contents from first file and its also trace the updated contents of that file from time to time.Once New file is generated in that directory,as usual,my application will copy the entire contents of that file to temporary file,but POS Text sender will not read that data and then if it has to display any contents,I should restart POS Text Sender.I really dont know how POS Text Sender knows that my application is copying from newly generated file and how to get it stopped.What is the difference between data writing to existing file and copy entire content from another
What is the difference between data writing to an existing file and copying the entire contents from another?
It sounds like maybe the 3rd-party app is looking at either the created or modified date stamp on the files, and not taking both into account. The difference is as follows:
when you create a new file, created and modified will be the same
when you edit an existing file, modified will be later than created
when you copy an existing file, the new file's created will be later than its modified timestamp

Resources