{"_id":"litmus-api","_rev":"15-5af63d33de0d57c6ddca42b6dc1e6046","name":"litmus-api","description":"Harness the power of the Litmus API to send tests to Litmus!","dist-tags":{"latest":"0.3.2"},"versions":{"0.1.0":{"name":"litmus-api","version":"0.1.0","description":"Harness the power of the Litmus API to send tests to Litmus!","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git://github.com/jeremypeter/litmus-api.git"},"keywords":["litmus","email","promise","api"],"author":{"name":"Jeremy Peter","email":"jeremywpeter@gmail.com","url":"http://www.jeremypeterdesigns.com/"},"license":"MIT","bugs":{"url":"https://github.com/jeremypeter/litmus-api/issues"},"homepage":"https://github.com/jeremypeter/litmus-api","dependencies":{"request":"~2.36.0","bluebird":"~1.2.4"},"devDependencies":{"chai":"~1.9.1","sinon":"~1.10.2","mocha":"*"},"_id":"litmus-api@0.1.0","dist":{"shasum":"944bb4354a36fd113aa10bbf1fa819a7ab4e9e95","tarball":"https://registry.npmjs.org/litmus-api/-/litmus-api-0.1.0.tgz","integrity":"sha512-xbN3GFhDlA56/waqt0WthYvBccIQEhA/aNWhiZqb912gdpX99MD48jw+Ffcbak4TLgo+zd8TIIe6XsM+DsZe/w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE0ZXV4R73ZWM/PFz1Y4gYinA54bBDcEvv6JunP2yOkGAiAsAGxLWokOlIme3HliYDOtwWV45cFRJee5mMbP/VmhLw=="}]},"_from":".","_npmVersion":"1.3.21","_npmUser":{"name":"jeremypeter","email":"jeremywpeter@gmail.com"},"maintainers":[{"name":"jeremypeter","email":"jeremywpeter@gmail.com"}]},"0.2.0":{"name":"litmus-api","version":"0.2.0","description":"Harness the power of the Litmus API to send tests to Litmus!","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git://github.com/jeremypeter/litmus-api.git"},"keywords":["litmus","email","promise","api"],"author":{"name":"Jeremy Peter","email":"jeremywpeter@gmail.com","url":"http://www.jeremypeterdesigns.com/"},"license":"MIT","bugs":{"url":"https://github.com/jeremypeter/litmus-api/issues"},"homepage":"https://github.com/jeremypeter/litmus-api","dependencies":{"request":"~2.36.0","bluebird":"~1.2.4"},"devDependencies":{"chai":"~1.9.1","sinon":"~1.10.2","mocha":"*"},"_id":"litmus-api@0.2.0","dist":{"shasum":"4e4b992d221b9fcbd7723ae074b6f988c6f019a9","tarball":"https://registry.npmjs.org/litmus-api/-/litmus-api-0.2.0.tgz","integrity":"sha512-oCROpVcjCszuClFwXUKpG93V/04kAnuNor1oQ4Pohb6BR/ik8IHLSldFA6OZeJhb53Hua2iHGv5Ki7eCGEHQxw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDD9MYmHmAuL61XYDB5tI21scciXmgEeyHmbnSCL0fh8AIgUXaapFIQ4nOjgNF7IKmMX5MwY7rutek215BGvWFHJpQ="}]},"_from":".","_npmVersion":"1.3.21","_npmUser":{"name":"jeremypeter","email":"jeremywpeter@gmail.com"},"maintainers":[{"name":"jeremypeter","email":"jeremywpeter@gmail.com"}]},"0.3.0":{"name":"litmus-api","version":"0.3.0","description":"Harness the power of the Litmus API to send tests to Litmus!","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git://github.com/jeremypeter/litmus-api.git"},"keywords":["litmus","email","promise","api"],"author":{"name":"Jeremy Peter","email":"jeremywpeter@gmail.com","url":"http://www.jeremypeterdesigns.com/"},"license":"MIT","bugs":{"url":"https://github.com/jeremypeter/litmus-api/issues"},"homepage":"https://github.com/jeremypeter/litmus-api","dependencies":{"request":"~2.36.0","bluebird":"~1.2.4"},"devDependencies":{"chai":"~1.9.1","sinon":"~1.10.2","mocha":"*"},"_id":"litmus-api@0.3.0","dist":{"shasum":"62a4ed541969e4468097c9a84226dd7d25165c17","tarball":"https://registry.npmjs.org/litmus-api/-/litmus-api-0.3.0.tgz","integrity":"sha512-yoXE1T1+FMP5AH14tKEz+0vtN3pq5KnixoDo2ILENOt7xJ0PGEvKI0JHOrWNsMk2lTmkNyZryj1FV8w7kD8uoA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHixCuukOp+a/EA5jMsXysqt2yLQpJX8a41ogMmQKdE0AiBHT6IY8K64PCusdVHxB4vujN5ygYsW+0rMlhtujgRxAA=="}]},"_from":".","_npmVersion":"1.3.21","_npmUser":{"name":"jeremypeter","email":"jeremywpeter@gmail.com"},"maintainers":[{"name":"jeremypeter","email":"jeremywpeter@gmail.com"}]},"0.3.2":{"name":"litmus-api","version":"0.3.2","description":"Harness the power of the Litmus API to send tests to Litmus!","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git://github.com/jeremypeter/litmus-api.git"},"keywords":["litmus","email","promise","api"],"author":{"name":"Jeremy Peter","email":"jeremywpeter@gmail.com","url":"http://www.jeremypeterdesigns.com/"},"license":"MIT","bugs":{"url":"https://github.com/jeremypeter/litmus-api/issues"},"homepage":"https://github.com/jeremypeter/litmus-api","dependencies":{"request":"~2.36.0","bluebird":"~1.2.4"},"devDependencies":{"chai":"~1.9.1","sinon":"~1.10.2","mocha":"*"},"_id":"litmus-api@0.3.2","dist":{"shasum":"71ed2aa713bb880bebad6673d438e52be33afcc8","tarball":"https://registry.npmjs.org/litmus-api/-/litmus-api-0.3.2.tgz","integrity":"sha512-DHhwXCQG/+BKtS8jADXKWZFqqLiEo/O84T7EYMWxj5YTZYMXHk9O35zlhQrdQ8Yu64sM12ljZ4mxK8+fzv8l6Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCMtlSy3yky+A1deYQS0FUwcNq6t3MCCZtIcSeZ/vAvsgIhALmcZ/YCaNh0hBqCmd0DGY78AusgEAPsM6SNEIUrObjj"}]},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"jeremypeter","email":"jeremywpeter@gmail.com"},"maintainers":[{"name":"jeremypeter","email":"jeremywpeter@gmail.com"}]}},"readme":"#litmus-api\nProvides methods that correlate with the [Litmus Customer API](http://docs.litmus.com/w/page/18056603/Customer%20API%20documentation). All methods return a promise thanks to the use of the [Bluebird](https://github.com/petkaantonov/bluebird) promise library. Be sure to read the [Bluebird API docs](https://github.com/petkaantonov/bluebird/blob/master/API.md) to learn about the different methods that can be used. \n\n## Example\n```js\nvar Litmus = require('litmus-api');\n\nvar api = new Litmus({\n    username: 'username',\n    password: 'password',\n    url: 'https://company.litmus.com'\n});\n\napi.getTests()\n    .then(function(data){\n        var response = data[0];\n        var body = data[1];\n        \n        console.log(response);\n        console.log(body);\n    });\n```\n\n## Constructor\n\n####`new Litmus(options)`\n\n`options` - required object that contains your Litmus credentials\n`options.username` - Litmus username    \n`options.password` - Litmus password   \n`options.url` - URL to your Litmus account \n\nExample\n```js\nvar options = {\n    username: 'username',\n    password: 'password',\n    url: 'https://company.litmus.com'\n};\nvar api = new Litmus(options);\n``` \n\n## Methods\n\n####`api.getTests()`\n**HTTP Method:** `GET`  \n**Reference:** [http://docs.litmus.com/Customer-API-Documentation:-tests](http://docs.litmus.com/Customer-API-Documentation:-tests)  \n\nReturns 100 results of the most recent tests \n\n<hr>\n\n####`api.getTest(testId)`\n**HTTP Method:** `GET`  \n**Reference:** [http://docs.litmus.com/Customer-API-documentation:-tests-show](http://docs.litmus.com/Customer-API-documentation:-tests-show)  \n`testId` - id of test  \n\nReturns the details of a single test by passing id of test\n\n<hr>\n\n####`api.updateTest(testId, body)`\n**HTTP Method:** `PUT`  \n**Reference:** [http://docs.litmus.com/Customer-API-Documentation:-tests-update](http://docs.litmus.com/Customer-API-Documentation:-tests-update)  \n`testId` - id of test  \n`body` - XML data\n\nUpdates a test in your account. This is used for publishing results publicly or changing a test's title.\n\n**Request body example:**  \n```xml\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test_set>\n  <public_sharing>true</public_sharing>\n  <name>Newsletter example</name>\n</test_set> \n```\n\n<hr>\n\n####`api.deleteTest(testId)`\n**HTTP Method:** `DELETE`  \n**Reference:** [http://docs.litmus.com/Customer-API-Documentation:-tests-destroy](http://docs.litmus.com/Customer-API-Documentation:-tests-destroy)  \n`testId` - id of test  \n\nDeletes a single test\n\n<hr>\n\n\n####`api.getVersions(testId)`\n**HTTP Method:** `GET`  \n**Reference:** [http://docs.litmus.com/Customer-API-documentation:-versions](http://docs.litmus.com/Customer-API-documentation:-versions)  \n`testId` - id of test  \n\nReturns all versions for a specified test\n\n<hr>\n\n####`api.getVersion(testId, version)`\n**HTTP Method:** `GET`  \n**Reference:** [http://docs.litmus.com/Customer-API-documentation:-versions-show](http://docs.litmus.com/Customer-API-documentation:-versions-show)  \n`testId` - id of test  \n`version` - version number of test\n\nReturns details of a single version for a particular test\n\n<hr>\n\n####`api.createVersion(testId)`\n**HTTP Method:** `POST`  \n**Reference:** [http://docs.litmus.com/Customer-API-documentation:-versions-create](http://docs.litmus.com/Customer-API-documentation:-versions-create)  \n`testId` - id of test  \n\nCreates a new version of a test.  \nCreating a new version of a web page test will re-test the same URL immediately. Creating a new version of an email test will return a new email address in the `url_or_guid` field and the received field will be `false`. You'll need to send an email to that address for received to become `true` and your screenshots to be generated. The `location` field of the headers returned will include a link to the newly created test.\n\n<hr>\n\n####`api.pollVersion(testId, version)`\n**HTTP Method:** `GET`  \n**Reference:** [http://docs.litmus.com/Customer-API-documentation:-versions-poll](http://docs.litmus.com/Customer-API-documentation:-versions-poll)  \n`testId` - id of test  \n`version` - version of test\n\nTo reduce the strain on the Litmus servers, and to reduce the bandwidth you use to check for test completion, there is a special poll method that can be used. The XML document returned will give an indication as to the status of each result. You may want to wait for every result to complete, or you may wish to return each result as it completes. You can check the status of the poll method and fetch the whole test version when the state for a particular result changes.\n\n<hr>\n\n####`api.getResults(testId, version)`\n**HTTP Method:** `GET`  \n**Reference:** [http://docs.litmus.com/Customer-API-documentation:-results](http://docs.litmus.com/Customer-API-documentation:-results)  \n`testId` - id of test  \n`version` - version of test\n\nRetrieves the complete collection of results for a particular test and version\n\n<hr>\n\n####`api.getResult(testId, version, resultId)`\n**HTTP Method:** `GET`  \n**Reference:** [http://docs.litmus.com/Customer-API-documentation:-results-show](http://docs.litmus.com/Customer-API-documentation:-results-show)  \n`testId` - id of test  \n`version` - version of test  \n`resultId` - id of a result in a collection of results\n\nUsed to retrieve details of a single result, useful when used in conjunction with the versions/poll method while waiting for individual results to complete.\n\n<hr>\n\n####`api.updateResult(testId, version, resultId, body)`\n**HTTP Method:** `PUT`  \n**Reference:** [http://docs.litmus.com/Customer-API-documentation:-results-update](http://docs.litmus.com/Customer-API-documentation:-results-update)  \n`testId` - id of test  \n`version` - version of test  \n`resultId` - id of a result in a collection of results\n`body` - XML data to send\n\nThis method is used to update the properties of a result. Currently the only operation supported by this is to set the compatibility state of a result (whether it appears with a green tick or red cross in the Litmus web interface). This is set via the `<check_state>` parameter which support either `ticked`, `crossed` or `nostate` as valid values. A result which returns `nil` for `<check_state>` is considered to be `nostate`.\n\n**Request body example**\n```xml\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<result>\n  <check_state>ticked</check_state>\n</result>\n```\n\n<hr>\n\n####`api.retestResult(testId, version, resultId)`\n**HTTP Method:** `POST`  \n**Reference:** [http://docs.litmus.com/Customer-API-documentation:-results-retest](http://docs.litmus.com/Customer-API-documentation:-results-retest)  \n`testId` - id of test  \n`version` - version of test  \n`resultId` - id of a result in a collection of results  \n\nTriggers a retest of just this client. Behaviour differs between page and email tests. For email tests we simply reuse the email source that was sent previously, this means it is best for just attempting to retest if an error occurred with a particular client. For page tests, this will revisit the url supplied when you started the test, meaning that any changes since the original test will be captured. Normally retesting like this is just best when an error occurs, if you've made changes to your email or page then testing by creating a new version is best.\n\n<hr>\n\n####`api.createEmailTest(body)`\n**HTTP Method:** `POST`  \n**Reference:** [http://docs.litmus.com/Customer-API-documentation:-emails-create](http://docs.litmus.com/Customer-API-documentation:-emails-create)  \n`body` - XML data to send  \n\nYou have two ways of sending a test to Litmus:  \n**1. Sending an email**  \nUsing this method, there are a few steps to the process of creating an email test and displaying it to the end user, the advantage is that it is that your email will arrive at Litmus in the same way that it will arrive in your customers inbox, via SMTP.  \n\n1. Create the new email test, specifying the email clients you wish to test it on.\n2. Record the new test's `<id>`, and its `<url_or_guid>`. \n3. Send the email that is to be tested, to the address specified in the `<url_or_guid>` field.\n4. Poll Litmus on the test's progress. The received field will be set to true when the email has been received by our system. \n5. Once the test is complete, record the URLs to the result screenshots, and present these to your user.   \n\nRequest body example: \n```xml\n<?xml version=\"1.0\"?>\n<test_set>\n  <applications type=\"array\">\n    <application>\n      <code>hotmail</code>\n    </application>\n    <application>\n      <code>gmail</code>\n    </application>\n    <application>\n      <code>notes8</code>\n    </application>\n  </applications>\n  <save_defaults>false</save_defaults>\n  <use_defaults>false</use_defaults>\n</test_set>\n```\n\n**2. Uploading HTML data**  \nFor this method, you simply supply your email body and subject as part of the XML request to the API. Simply change your request to look like this, everything else remains the same as the example above.\n\nRequest body example: \n```xml\n<?xml version=\"1.0\"?>\n<test_set>\n  <applications type=\"array\">\n    <application>\n      <code>hotmail</code>\n    </application>\n    <application>\n      <code>gmail</code>\n    </application>\n    <application>\n      <code>notes8</code>\n    </application>\n  </applications>\n  <save_defaults>false</save_defaults>\n  <use_defaults>false</use_defaults>\n  <email_source>\n     <body><![CDATA[your-email-html-goes-here]]></body>\n     <subject>My test email to Litmus</subject>\n  </email_source>\n</test_set>\n```\n<hr>\n\n####`api.getEmailClients()`\n**HTTP Method:** `GET`  \n**Reference:** [http://docs.litmus.com/Customer-API-documentation:-emails-clients](http://docs.litmus.com/Customer-API-documentation:-emails-clients)  \n\nReturns a list of email clients available for testing.  \n\n<hr>\n\n####`api.createBrowserTest(body)`\n**HTTP Method:** `POST`  \n**Reference:** [http://docs.litmus.com/Customer-API-documentation:-pages-create](http://docs.litmus.com/Customer-API-documentation:-pages-create)  \n`body` - XML data to send  \n\nCreates a new web page test in your account.  \nThis will create a new web page test, there are a few steps to the process of creating a test and displaying it to the end user:\n\n1. Create the new test with the URL to the page you're testing, along with the browsers you wish to test it on. \n2. Record the new test's `<id>`. (Contained in response to previous POST)\n3. Poll Litmus on the test's progress. \n4. Once the test is complete, record the URLs to the result screenshots, and present these to your user.  \n\nRequest body example: \n```xml\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test_set>\n  <applications type=\"array\">\n    <application>\n      <code>saf2</code>\n    </application>\n    <application>\n      <code>ie7</code>\n    </application>\n    <application>\n      <code>ie6</code>\n    </application>\n  </applications>\n  <url>http://google.com</url>\n  <save_defaults>false</save_defaults>\n  <use_defaults>false</use_defaults>\n</test_set>\n```\n\n<hr>\n\n####`api.getBrowserClients()`\n**HTTP Method:** `GET`  \n**Reference:** [http://docs.litmus.com/Customer-API-documentation:-pages-clients](http://docs.litmus.com/Customer-API-documentation:-pages-clients)  \n\nReturns a list of web browsers available for testing  \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","maintainers":[{"name":"jeremypeter","email":"jeremywpeter@gmail.com"}],"time":{"modified":"2022-06-19T12:51:53.038Z","created":"2014-06-04T00:46:34.919Z","0.1.0":"2014-06-04T00:46:34.919Z","0.2.0":"2014-06-04T01:00:36.493Z","0.3.0":"2014-06-04T01:07:05.439Z","0.3.2":"2014-06-04T06:25:54.895Z"},"homepage":"https://github.com/jeremypeter/litmus-api","keywords":["litmus","email","promise","api"],"repository":{"type":"git","url":"git://github.com/jeremypeter/litmus-api.git"},"author":{"name":"Jeremy Peter","email":"jeremywpeter@gmail.com","url":"http://www.jeremypeterdesigns.com/"},"bugs":{"url":"https://github.com/jeremypeter/litmus-api/issues"},"license":"MIT","readmeFilename":"README.md","users":{"npmmax":true}}