fork(1) download
  1. /**
  2.  * @NApiVersion 2.x
  3.  * @NScriptType Restlet
  4.  * @NModuleScope SameAccount
  5.  */
  6. define(['N/search', 'N/record'],
  7. /**
  8.   * @param {search} search
  9.   * @param {record} record
  10.   */
  11. function (search, record) {
  12.  
  13. /**
  14.   * Function called upon sending a GET request to the RESTlet.
  15.   *
  16.   * @param {Object} requestParams - Parameters from HTTP request URL; parameters will be passed into function as an Object (for all supported content types)
  17.   * @returns {string | Object} HTTP response body; return string when request Content-Type is 'text/plain'; return Object when request Content-Type is 'application/json'
  18.   * @since 2015.1
  19.   */
  20. function doGet() {
  21.  
  22. }
  23.  
  24. /**
  25.   * Function called upon sending a PUT request to the RESTlet.
  26.   * @param {string | Object} requestBody - The HTTP request body; request body will be passed into function as a string when request Content-Type is 'text/plain'
  27.   * or parsed into an Object when request Content-Type is 'application/json' (in which case the body must be a valid JSON)
  28.   * @returns {string | Object} HTTP response body; return string when request Content-Type is 'text/plain'; return Object when request Content-Type is 'application/json'
  29.   * @since 2015.2
  30.   */
  31. function doPut(requestBody) {
  32.  
  33. }
  34.  
  35. /**
  36.   * Function called upon sending a POST request to the RESTlet.
  37.   *
  38.   * @param {string | Object} requestBody - The HTTP request body; request body will be passed into function as a string when request Content-Type is 'text/plain'
  39.   * or parsed into an Object when request Content-Type is 'application/json' (in which case the body must be a valid JSON)
  40.   * @returns {string | Object} HTTP response body; return string when request Content-Type is 'text/plain'; return Object when request Content-Type is 'application/json'
  41.   * @since 2015.2
  42.   */
  43. function doPost(requestBody) {
  44. log.debug('Hello, World', requestBody);
  45. }
  46.  
  47. /**
  48.   * Function called upon sending a DELETE request to the RESTlet.
  49.   *
  50.   * @param {Object} requestParams - Parameters from HTTP request URL; parameters will be passed into function as an Object (for all supported content types)
  51.   * @returns {string | Object} HTTP response body; return string when request Content-Type is 'text/plain'; return Object when request Content-Type is 'application/json'
  52.   * @since 2015.2
  53.   */
  54. function doDelete(requestParams) {
  55.  
  56. }
  57.  
  58. return {
  59. 'get': doGet,
  60. 'put': doPut,
  61. 'post': doPost,
  62. 'delete': doDelete
  63. };
  64.  
  65. });
Runtime error #stdin #stdout #stderr 0.24s 2313728KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
js: uncaught JavaScript runtime exception: ReferenceError: "define" is not defined.