This project is a simple wrapper to help sending JSON payloads using Coveo Cloud V2 PushAPI.
The code in this project uses the Push API from the Coveo Cloud V2 Platform. You can use the following resource for more information and get started:
- Push API documentation: https://docs.coveo.com/en/68/cloud-v2-developers/push-api
- Branch or Fork
- Pull Request
- And... that's pretty much it!
git clone
this project.npm install
to get the dependencies (request, fs).
Install it with NPM:
npm i coveo-pushapi-cli --global
The first time you run in one folder, it will help you to set up your config .pushapi-config.json
by asking about your sourceId
and your API key
.
Note For a source in a Coveo Cloud HIPAA org, you need to manually add the following line to the
.pushapi-config.json
file:
"platform": "pushhipaa.cloud.coveo.com"
.
-
Push one JSON payload file:
pushapi file.json
where
file.json
is a the path to a Push API payload (JSON) file. Don't forget to setDocumentId
in the payloads. -
Push one JSON payload file, but delete source item older than 24 hours:
pushapi file.json -d 24
to use typically when you create/update all valid items, you want to delete all othere items that are older.
-
Push all JSON payload files from one folder:
pushapi folder
where
folder
is teh path to a folder containing multiple Push API JSON payload files.
The helper does a minimal validation on the payload, then executes these API calls:
- Change source state to REBUILD
- Get a File container
- Upload the payload to the File container
- Sends the batch command to process the File container
- Change the source state back to IDLE
Note You can add this attribute
"debug": true
in your.pushapi-config.json
to see these requests and their response code.
- Node.js
- Node modules:
fs
,request
- Jérôme Devost (https://github.com/jdevost)