
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
@smile/strapi-client
Advanced tools
An HTTP client for Strapi focused on content and media creation (for mass data migration from another CMS/datasource)
An HTTP client for Strapi focused on content and media creation (for mass data migration from another CMS/datasource).
While other clients may exist, this one is focused on content and media creation with possibility to create Media directories and moving media in directories.
In your migration project.
npm i -D @smile/strapi-client
import {StrapiClient} from '@smile/strapi-client';
const strapiClient = new StrapiClient('http://127.0.0.1:1337', 'token', 'admin_token');
'token'
is an API token that you must create in Strapi. The token must have enough access (e.g.: "Full access") to be able to create the required content.'admin_token'
is optional (for creating media folders and moving media in the Media Library and for publisher plugins) and must be a JWT token (check in your browser local storage after authenticating to Strapi admin). The user associated to that JWT token must have enough rights to manage the Media Library.Examples below are based on FoodAdvisor Strapi demo.
const creationResponse = await strapiClient.createEntry('articles', {
title: '5 Famous Restaurants You Have to Visit in Paris',
ckeditor_content: `<div class="entry-content">
<h3>As one of the top food destinations in the world, there’s no shortage of famous restaurants in Paris.</h3>
<p>From historic addresses to those made famous by celebrity diners, here we round up some of the most iconic Paris restaurants that are actually worth a visit. </p>`
});
const mediaCreationResponse = await strapiClient.addMediaAsset('https://assets2.devourtours.com/wp-content/uploads/famous-restaurants-in-paris-1.png', 'Some of the most famous restaurants in Paris have gotten quite touristy and aren\'t really worth your time. Here are five that fortunately manage to stay authentic in the face of mass tourism.', 'Photo Credit: Hirama for Tour d’Argent');
Requires adminToken
.
const mediaFolderCreationResponse = await strapiClient.createMediaFolder('Famous restaurants');
Requires adminToken
.
await strapiClient.moveMedia(mediaFolderCreationResponse.data.id, [mediaCreationResponse[0].id]);
await strapiClient.updateEntry('articles', creationResponse.data.id, {
publicationState: 'In review',
image: mediaCreationResponse[0].id
});
Requires:
You first need to tell the Strapi client which plugin you're using with:
strapiClient.configureScheduler('strapi-plugin-publisher');
// Or
strapiClient.configureScheduler('@webbio-strapi-plugin-scheduler');
Then, set a publish date with:
const in10Days = new Date(new Date().setDate(new Date().getDate() + 10));
await strapiClient.addPublishDate('article', creationResponse.data.id, in10Days);
and an unpublish date with:
const in30Days = new Date(new Date().setDate(new Date().getDate() + 30));
await strapiClient.addUnpublishDate('article', creationResponse.data.id, in30Days);
FAQs
An HTTP client for Strapi focused on content and media creation (for mass data migration from another CMS/datasource)
The npm package @smile/strapi-client receives a total of 39 weekly downloads. As such, @smile/strapi-client popularity was classified as not popular.
We found that @smile/strapi-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.