{"id":13456478,"url":"https://github.com/agenda/agenda-rest","last_synced_at":"2025-04-09T06:10:27.579Z","repository":{"id":41262842,"uuid":"75718417","full_name":"agenda/agenda-rest","owner":"agenda","description":"Scheduling as a Service","archived":false,"fork":false,"pushed_at":"2024-09-15T10:18:29.000Z","size":1112,"stargazers_count":144,"open_issues_count":12,"forks_count":43,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-04-02T02:06:02.160Z","etag":null,"topics":["agenda","agenda-rest","cron","rest","scheduling"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agenda.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-06T09:58:46.000Z","updated_at":"2024-12-10T23:51:54.000Z","dependencies_parsed_at":"2024-10-29T00:30:32.378Z","dependency_job_id":"7ec3fc2e-438c-4c67-b042-2e2ac89b2e0e","html_url":"https://github.com/agenda/agenda-rest","commit_stats":{"total_commits":456,"total_committers":18,"mean_commits":"25.333333333333332","dds":0.4144736842105263,"last_synced_commit":"45ff9a847c7e1f3bfdda11ed3227be77d83cd8eb"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agenda%2Fagenda-rest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agenda%2Fagenda-rest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agenda%2Fagenda-rest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agenda%2Fagenda-rest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agenda","download_url":"https://codeload.github.com/agenda/agenda-rest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247987285,"owners_count":21028895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agenda","agenda-rest","cron","rest","scheduling"],"created_at":"2024-07-31T08:01:22.771Z","updated_at":"2025-04-09T06:10:27.557Z","avatar_url":"https://github.com/agenda.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Job Scheduling and Queues"],"sub_categories":["React Components"],"readme":"[![npm version](https://badge.fury.io/js/agenda-rest.svg)](https://www.npmjs.com/package/agenda-rest)\n\u003ca href=\"http://travis-ci.org/agenda/agenda-rest\"\u003e\u003cimg src=\"https://api.travis-ci.org/agenda/agenda-rest.svg?branch=master\" alt=\"Build Status\"\u003e\u003c/a\u003e\n\u003ca href=\"https://slackin-ekwifvcwbr.now.sh/\"\u003e\u003cimg src=\"https://slackin-ekwifvcwbr.now.sh/badge.svg\" alt=\"Slack Status\"\u003e\u003c/a\u003e\n\n# agenda-rest\n\nScheduling as a Service, based on [Agenda](https://github.com/agenda/agenda)\n\nAssuming all job types could be thought of as REST endpoints, scheduling could be offered as a service. `agenda-rest` does just that, introduce a URL, name it, agenda-rest will call it on the times that you specify.\n\n## Installation\n\nInstall agenda-rest as a global package\n\n```bash\nnpm install -g agenda-rest\n```\n\n## Usage\n\nTo launch the agenda-rest server, use the command line interface specifying the database host name and the database name\n\n```bash\nagenda-rest --dbhost localhost --dbname agenda\n```\n\n## Command Line Interface options\n\n| Options                     | Description                                                                                                             |\n| --------------------------- | ----------------------------------------------------------------------------------------------------------------------- |\n| **`-d, --dbname`**          | [optional] Name of the Mongo database, default is **agenda**                                                            |\n| **`-h, --dbhost`**          | [optional] Mongo instance's IP or domain name, default is **localhost**                                                 |\n| **`-u, --dburi`**           | [optional] Full Mongo connection string. If specified, will override **--dbhost**, **--dbname**                         |\n| **`-p, --port`**            | [optional] agenda-rest server port, default is **4040**                                                                 |\n| **`-k, --key`**             | [optional] x-api-key to be expected in headers. If not specified, access to agenda-rest server would be unauthenticated |\n| **`-t, --timeout`**         | [optional] Timeout for request duration, default is **5000 ms**                                                         |\n| **`-a, --agenda_settings`** | [optional] A JSON string containing additional agenda settings. For example '{ \"processEvery\": \"30 seconds\" }'          |\n\n## APIs\n\n## API Documentation\n\nAPI Documentation (Postman Generated) available at https://explore.postman.com/templates/4883/agenda-rest\n\n### **GET `/api/job`**\n\nGet a list of defined jobs\n\n- Method: GET\n\n### **POST `/api/job`**\n\nDefines a new category of jobs\n\n- Method: POST\n- Data:\n\n```javascript\n{\n    name,           // New job type's name\n    url,            // koa-router style url\n    method,         // (optional) Request type, default: POST\n    callback: {     // (optional) to call with response after invocation\n        url,\n        method,\n        headers\n    }\n}\n```\n\n### **PUT `/api/job/:jobName`**\n\nUpdates definition of a job category\n\n- Method: PUT\n- Data: same as POST `/api/job`\n\n### **DELETE `/api/job/:jobName`**\n\nDeletes job definition and cancels occurrences\n\n- Method: DELETE\n\n### **POST `/api/job/once`** \u0026 **POST `/api/job/every`**\n\nSchedule a job for single or multiple occurrences\n\n- Method: POST\n- Data:\n\n```javascript\n{\n    name,           // Name of the type to create the instance from\n    interval,       // Interval in which job should be invoked (human-interval, can also be a date string for 'once')\n    data: {         // (optional) default: {}\n        headers,    // Http headers, e.g. { Authorization: '\u003ctoken\u003e' }\n        params,     // An object i.e. { param1: 'value1' } used to replace path parameters `http://mydommain.com:3333/test/:param1` =\u003e `http://mydommain.com:3333/test/value1` notations in the job definition's url.\n        query,      // An object i.e. { foo: 'bar', baz: 'qux' } used to create query parameters (http://mydommain.com:3333/test/value1?foo=bar\u0026baz=qux)\n        body        // Accompanying data sent along the request\n    },\n    options: { // (optional) Enables passing options to the `every` method in agenda as documented [here](https://github.com/agenda/agenda#repeateveryinterval-options)\n      timezone, // Specify the job execution timezone.\n      skipImmediate // Don't execute job immidiatly default is `false`.\n    }\n}\n```\n\nCallback, if present, would be invoked by the following object:\n\n```javascript\n{\n    data: {\n        // passed data object, same as above\n    },\n    response        // response from invocation\n}\n```\n\n### **POST `/api/job/now`**\n\nLike `once` and `every`, though without `interval`. Executes the job now.\n\n### **POST `/api/job/cancel`**\n\nCancels (not to be confused with 'delete') any jobs matching the query\n\n- Method: POST\n- Data: Mongo query\n\n```javascript\n{\n  name: \"foo\"\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagenda%2Fagenda-rest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagenda%2Fagenda-rest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagenda%2Fagenda-rest/lists"}