Last updated 5 years ago by guidesmiths .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install node-madgex 
SYNC missed versions from official npm registry.


Build Status

A node.js client for Madgex web services.


Madgex's web services are split between RESTful and SOAP APIs. This module currently supports only a subset of the APIs, but we would be delighted to receive pull requests for the methods that are missing.

The current set of supported web services is


  1. getinfo
  2. employer
  3. myjobs

Billing API

  1. AddBilledJob
  2. AddRecruiterV2
  3. GetCategories
  4. GetCategoryTerms
  5. GetLocations
  6. UpdateBilledJob
  7. UpdateRecruiterWithBillingID
  8. AddPrePaidCredits
  9. CheckRecruiterExistsV2



var madgex = require('node-madgex')
var client = madgex.createClient('',  { key: 'yourkey', secret: 'yoursecret' })

client.restApi.jobinfo({ jobid: 1257 }, function(err, data) {

API methods usually accept a params hash and a completion callback with (err, data, result) signature;


As an alternative to the completion callback you can use promises as well. Api methods return with a promise that resolves after the completion callback (if one is present).

client.jobinfo({ jobid: 1257 })
      .then(function(data) {
          //handle data
      .fail(function(err) {
          //dome something with the error


Promised values are easy to compose:

      .then(function(jobs) { return client.jobinfo({jobid: jobs[0].id }) })
      .then(function(jobdetails) { /*handle data*/ })
      .fail(function(err) { /*dome something with the error */ });

Service Description

The RESTful client API is dynamically built by code from the service description config file. Extend this to add new functions to the API. (/lib/rest-api-service-description.json)

Service Methods

jobinfo(params, done)

Displays information about a job


a hash with the following fields

field type,info
jobid integer, required, done)

Searches in the job database

field type,info
keywords free text with boolean expressions allowed, optional
dateFrom ISO format date
dateTo ISO format date

...and much more. refer to the Madgex REST documentation for full set of params., done)

Same as search but returns full dataset, done)

Return search refiners for a search result. Params are same as in search()

employer(params, done)

Displays information about am employer


a hash with the following fields

field type,info
id integer, required, done)

Searches in the employer database

myjobs.add(params, done)

myjobs.delete(params, done)



var madgex = require('node-madgex')
var client = madgex.createClient('',  { key: 'yourkey', secret: 'yoursecret' })

client.soapApi.billingApi.getCategoryTerms({ categoryId: 105 }, function(err, data) {

Each billingApi method takes an optional parameters object and typical callback. You can determine the available parameters names by inspecting the equivalent methods handlebars template (see ./lib/soap-templates/*.hbs). These are camel cased equivalents to the elements specified in the Madgex Billing API documentation. Working out which parameters are required and what their values should be requires a degree of experience.

Responses stripped of their SOAPiness and converted to camelCased json. Integers, floats and booleans are parsed, so instead of

<soap:Envelope xmlns:soap="" xmlns:xsi="" xmlns:xsd="">
        <GetCategoriesResponse xmlns="">

you'll receive

        "mandatory": false,
        "multiSelect": true,
        "id": 105,
        "name": "hours"

Error handling

In the event of an HTTP error, the err object passed to your callback will be blessed with a 'statusCode' property. In the event ofa SOAP Fault, the err object will additionally be blessed with 'faultCode' and 'faultString' properties.

Adding more SOAP API methods

Adding more API methods is easy

  1. Fork and clone node-madgex
  2. Generate a real request and response using your tool of choice (SoapUI, curl, etc)
  3. Convert the request to a handlbars template and save it in lib/soap-templates/MethodName.hbs,
  4. Save the response in test/replies/soap/MethodName.ok.xml
  5. Update lib/soap-api-service-description.json
  6. Add one or more test cases
  7. Submit a PR

Current Tags

  • 0.0.8                                ...           latest (5 years ago)

5 Versions

  • 0.0.8                                ...           5 years ago
  • 0.0.5                                ...           5 years ago
  • 0.0.3                                ...           5 years ago
  • 0.0.2                                ...           5 years ago
  • 0.0.1                                ...           5 years ago
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (13)
Dev Dependencies (2)
Dependents (0)

Copyright 2014 - 2017 © |