{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"fd540bd2-1f53-4e84-a78e-180f7fc8470f","name":"PTNetsuite REST API STANDARD","description":"# Common\n\nThe following paragraph describes a set of advanced operations that could be applied in the REST APIs.\n\nWe support the following features:\n* Pagination\n* Filtering\n* Sorting\n\n---\n\n## Pagination in the REST API: \n\n### Why pagination?\n\nA PTNetsuite REST API response potentially provides plenty of data. Under this condition, a feature to limit the incoming info and split it into chunk of data is a highly valuable tool. Precisely for this reason the pagination functionality is provided: using the pagination the API response info is much easier to handle.\n\n### Set and understand the parameters\nThe paging functionality allows to split the server response, setting a limit and an offset to the number of items returned in the API response.\n\nThe following fields are present in all the `GET` method that return a `rows` object:\n* `offset`: the index of the first item in the response\n* `limit`: the maximum number of items in the response\n* `size`: the total number of items in the response\n\nIf `limit` : 5 and `offset` : 0, the response returns at most the first five elements (from 0 to 4).\n\nIf `offset` : 5 and `limit` : 2, we return elements from 5 to 6.\n\n#### How do we know if there are more pages?\n\nThe total number of pages depends on the provided `limit` and `size`.\n\nFor example, if `limit`:5 and `size`:10, the total number of pages will be 2.\n\n#### Limitations\n\nThe maximum value for `limit` is 100, bigger values will be replaced by the max value. Hence, 100 elements will be returned at most.\n\n---\n\n## Filtering:\n\nFilters are perfect if ou want that the response provides only a subset of the whole result of a `GET` REST API. The filter is set using the query string format: \n\n```\n/api/v2/{resource}?{{key}}={{value}}\n```\n\nwhere:\n   * `{resource}`\n   * `{{key}}` available keywords are listed in the API page\n   * `{{value}}`\n\nIt's possible to provide N pairs `{{key}}={{value}}` separated by `&` (see query string URL notation)\n\nAn example for the `gateway-profiles` resource is:\n\n`/api/v2/gateway-profiles?band=EU863-870&maxTxPower=27`\n\nit provides a filter to get the list of the gateway profiles with band=EU863-870 and maxTxPower=27.\n\nNote that each REST API has its own filters.\n\n## Sorting:\n\nThe `GET` REST APIs provide the logic to set the order of the items in the response. Sorting is set by the `sort` query string parameter:\n\n```\n/api/v2/{resource}?sort={{key1}}:{{method}},{{key2}}:{{method}}\n```\n\nWhere the available `{{method}}` values are:\n\n* `desc`: descending order\n* `asc`: ascending order\n\nand the `{{key}}` depends on the REST API that we want to use.\n\nFor example, let's use the method `GET` on the resource `gateway-profiles` setting the descending order on `createdAt` timestamp:\n\n```\n/api/v2/gateway-profiles?sort=createdAt:desc\n```\n\nFor a sort in cascade:\n```\n/api/v2/gateway-profiles?sort=createdAt:desc,id:asc\n```\n\n## Filtering & Sorting:\n\nTo set a filter and sort the result we provide the possibility to concatenate both the functionalities:\n\nFor example, let's use the method `GET` on the resource `gateway-profiles` to get all the profiles with a `band=EU863-870` and `maxTxPower=14` setting the ascending order on `id`:\n\n```\n/api/v2/gateway-profiles?band=EU863-870&maxTxPower=14&sort=id:asc\n```\n\n---\n\n## Response in the REST API: \n\nIn the response,  there are also some informations:\n* `createdAt`: indicate the timestamp set when we create the required item\n* `updatedAt`: indicate the timestamp of the last item's update\n\n---\n\n# Error Code:\n\nAll the REST API may return one of the following error code as response: \n\n| Status | Description | Solution \n| --- | --- | --- | \n| 400 | Bad Request | The request could not be fulfilled due to syntax errors. The errors can be present both in the query string and in the body of the call.\n| 401 | No authorization | Get an authorization token after login using credentials that can access the desired resource \n| 403 | Forbidden | The user cannot access the requested resource\n| 404 | Not Found | The requested resource was not found\n\n## Error code example: \n\nReturn code 400:\n\n```\n{\n    \"status\": 400,\n    \"message\": \"params should NOT have additional properties\"\n}\n```\n\nReturn code 401: \n``` \n{\t\"status\": 401, \n\t\"message\": \"No authorization token was found\", \n\t\"code\": \"credentials_required\", \n\t\"inner\": { \n\t\t\"message\": \"No authorization token was found\" \n\t} \n} \n```\n\nReturn code 404:\n\n```\n{\n    \"status\": 404,\n    \"message\": \"Gateway not found\"\n}\n```\n\n--- \n\n# Used tools\n\nDocumentation created with:\n\nhttps://github.com/adobe/jsonschema2md","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":true,"owner":"7664580","collectionId":"fd540bd2-1f53-4e84-a78e-180f7fc8470f","publishedId":"SW11XeM5","public":true,"publicUrl":"https://doc.v2.smartcitylab.io","privateUrl":"https://go.postman.co/documentation/7664580-fd540bd2-1f53-4e84-a78e-180f7fc8470f","customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"documentationLayout":"classic-double-column","customisation":{"metaTags":[{"name":"description","value":"For standard user"},{"name":"title","value":"PTNetsuite REST API documentation"}],"appearance":{"default":"light","themes":[{"name":"dark","logo":null,"colors":{"top-bar":"212121","right-sidebar":"303030","highlight":"FF6C37"}},{"name":"light","logo":null,"colors":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"}}]}},"version":"8.10.1","publishDate":"2023-06-07T14:16:17.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{"title":"PTNetsuite REST API documentation","description":"For standard user"},"logos":{"logoLight":null,"logoDark":null}},"statusCode":200},"environments":[{"name":"net.smartcitylab.io","id":"3329cb39-dcbc-49af-99b2-8a9046bbc481","owner":"5573287","values":[{"key":"host","value":"net.smartcitylab.io","enabled":true},{"key":"protocol","value":"https","enabled":true},{"key":"uid","value":"","enabled":true},{"key":"token","value":"","enabled":true}],"published":true}],"user":{"authenticated":false,"permissions":{"publish":false}},"run":{"button":{"js":"https://run.pstmn.io/button.js","css":"https://run.pstmn.io/button.css"}},"web":"https://www.getpostman.com/","team":{"logo":"https://res.cloudinary.com/postman/image/upload/t_team_logo_pubdoc/v1/team/1a1334787bb8fdd9c53b5806da15c6bbe76d42e8b59c6f331341816f12c31895","favicon":"https://res.cloudinary.com/postman/image/upload/v1579254413/team/btjadtpn6z5wwv6fk404.ico"},"isEnvFetchError":false,"languages":"[{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"HttpClient\"},{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"RestSharp\"},{\"key\":\"curl\",\"label\":\"cURL\",\"variant\":\"cURL\"},{\"key\":\"dart\",\"label\":\"Dart\",\"variant\":\"http\"},{\"key\":\"go\",\"label\":\"Go\",\"variant\":\"Native\"},{\"key\":\"http\",\"label\":\"HTTP\",\"variant\":\"HTTP\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"OkHttp\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"Unirest\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"Fetch\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"jQuery\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"XHR\"},{\"key\":\"c\",\"label\":\"C\",\"variant\":\"libcurl\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Axios\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Native\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Request\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Unirest\"},{\"key\":\"objective-c\",\"label\":\"Objective-C\",\"variant\":\"NSURLSession\"},{\"key\":\"ocaml\",\"label\":\"OCaml\",\"variant\":\"Cohttp\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"cURL\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"Guzzle\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"HTTP_Request2\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"pecl_http\"},{\"key\":\"powershell\",\"label\":\"PowerShell\",\"variant\":\"RestMethod\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"http.client\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"Requests\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"httr\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"RCurl\"},{\"key\":\"ruby\",\"label\":\"Ruby\",\"variant\":\"Net::HTTP\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"Httpie\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"wget\"},{\"key\":\"swift\",\"label\":\"Swift\",\"variant\":\"URLSession\"}]","languageSettings":[{"key":"csharp","label":"C#","variant":"HttpClient"},{"key":"csharp","label":"C#","variant":"RestSharp"},{"key":"curl","label":"cURL","variant":"cURL"},{"key":"dart","label":"Dart","variant":"http"},{"key":"go","label":"Go","variant":"Native"},{"key":"http","label":"HTTP","variant":"HTTP"},{"key":"java","label":"Java","variant":"OkHttp"},{"key":"java","label":"Java","variant":"Unirest"},{"key":"javascript","label":"JavaScript","variant":"Fetch"},{"key":"javascript","label":"JavaScript","variant":"jQuery"},{"key":"javascript","label":"JavaScript","variant":"XHR"},{"key":"c","label":"C","variant":"libcurl"},{"key":"nodejs","label":"NodeJs","variant":"Axios"},{"key":"nodejs","label":"NodeJs","variant":"Native"},{"key":"nodejs","label":"NodeJs","variant":"Request"},{"key":"nodejs","label":"NodeJs","variant":"Unirest"},{"key":"objective-c","label":"Objective-C","variant":"NSURLSession"},{"key":"ocaml","label":"OCaml","variant":"Cohttp"},{"key":"php","label":"PHP","variant":"cURL"},{"key":"php","label":"PHP","variant":"Guzzle"},{"key":"php","label":"PHP","variant":"HTTP_Request2"},{"key":"php","label":"PHP","variant":"pecl_http"},{"key":"powershell","label":"PowerShell","variant":"RestMethod"},{"key":"python","label":"Python","variant":"http.client"},{"key":"python","label":"Python","variant":"Requests"},{"key":"r","label":"R","variant":"httr"},{"key":"r","label":"R","variant":"RCurl"},{"key":"ruby","label":"Ruby","variant":"Net::HTTP"},{"key":"shell","label":"Shell","variant":"Httpie"},{"key":"shell","label":"Shell","variant":"wget"},{"key":"swift","label":"Swift","variant":"URLSession"}],"languageOptions":[{"label":"C# - HttpClient","value":"csharp - HttpClient - C#"},{"label":"C# - RestSharp","value":"csharp - RestSharp - C#"},{"label":"cURL - cURL","value":"curl - cURL - cURL"},{"label":"Dart - http","value":"dart - http - Dart"},{"label":"Go - Native","value":"go - Native - Go"},{"label":"HTTP - HTTP","value":"http - HTTP - HTTP"},{"label":"Java - OkHttp","value":"java - OkHttp - Java"},{"label":"Java - Unirest","value":"java - Unirest - Java"},{"label":"JavaScript - Fetch","value":"javascript - Fetch - JavaScript"},{"label":"JavaScript - jQuery","value":"javascript - jQuery - JavaScript"},{"label":"JavaScript - XHR","value":"javascript - XHR - JavaScript"},{"label":"C - libcurl","value":"c - libcurl - C"},{"label":"NodeJs - Axios","value":"nodejs - Axios - NodeJs"},{"label":"NodeJs - Native","value":"nodejs - Native - NodeJs"},{"label":"NodeJs - Request","value":"nodejs - Request - NodeJs"},{"label":"NodeJs - Unirest","value":"nodejs - Unirest - NodeJs"},{"label":"Objective-C - NSURLSession","value":"objective-c - NSURLSession - Objective-C"},{"label":"OCaml - Cohttp","value":"ocaml - Cohttp - OCaml"},{"label":"PHP - cURL","value":"php - cURL - PHP"},{"label":"PHP - Guzzle","value":"php - Guzzle - PHP"},{"label":"PHP - HTTP_Request2","value":"php - HTTP_Request2 - PHP"},{"label":"PHP - pecl_http","value":"php - pecl_http - PHP"},{"label":"PowerShell - RestMethod","value":"powershell - RestMethod - PowerShell"},{"label":"Python - http.client","value":"python - http.client - Python"},{"label":"Python - Requests","value":"python - Requests - Python"},{"label":"R - httr","value":"r - httr - R"},{"label":"R - RCurl","value":"r - RCurl - R"},{"label":"Ruby - Net::HTTP","value":"ruby - Net::HTTP - Ruby"},{"label":"Shell - Httpie","value":"shell - Httpie - Shell"},{"label":"Shell - wget","value":"shell - wget - Shell"},{"label":"Swift - URLSession","value":"swift - URLSession - Swift"}],"layoutOptions":[{"value":"classic-single-column","label":"Single Column"},{"value":"classic-double-column","label":"Double Column"}],"versionOptions":[],"environmentOptions":[{"value":"0","label":"No Environment"},{"label":"net.smartcitylab.io","value":"5573287-3329cb39-dcbc-49af-99b2-8a9046bbc481"}],"canonicalUrl":"https://doc.smartcitylab.io/view/metadata/SW11XeM5"}