{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":865,"path":"api-reference/server-api-reference/PASnapshot.md","title":"PASnapshot - Scoped","bundle":null,"doc_type":null,"release":"australia","body":"\n# PASnapshot- Scoped\n\nThe PASnapshot API enables you to query information about Performance Analytics snapshots. Snapshots are the lists of records \\(sys\\_ids\\) that are collected at the time that the scores for those records are collected. A snapshot is made only for automated indicators with **Collect records** selected.\n\nYou can query information about a snapshot at a certain date using the indicator sys\\_id and date, and perform comparisons between snapshots for an indicator at different dates.\n\n**Parent Topic:**[Server API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/api-server.md)\n\n## PASnapshot - getCompareIDs\\(String sys\\_id, Number date1, Number date2, String type\\)\n\nCompares records in snapshots for a specified indicator at multiple dates, such as to identify records included in one snapshot but not the other.\n\n<table id=\"table_jrk_qcq_nw\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nsys\\_id\n\n</td><td>\n\nString\n\n</td><td>\n\nIndicator's sys\\_id.\n\n</td></tr><tr><td>\n\ndate1\n\n</td><td>\n\nNumber\n\n</td><td>\n\nDate of the first snapshot.Format: yyyymmdd\n\n</td></tr><tr><td>\n\ndate2\n\n</td><td>\n\nNumber\n\n</td><td>\n\nDate of the second snapshot.Format: yyyymmdd\n\n</td></tr><tr><td>\n\ntype\n\n</td><td>\n\nString\n\n</td><td>\n\nData to retrieve. Valid values:\n\n-   all1: all records in the first snapshot\n-   all2: all records in the second snapshot\n-   shared: records that are in both snapshots\n-   movedin: records that are in the first snapshot, but not the second\n-   movedout: records that are in the second snapshot, but not the first\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|String|A comma-separated list of sys\\_id values.|\n\n```\nvar snapshot2 = PASnapshot.getCompareIDs('fb007202d7130100b96d45a3ce6103b4', 20160430, 20160531, 'shared');\ngs.info(snapshot2);\n```\n\nOutput:\n\n```\n*** Script: 09c01200d7002100b81145a3ce6103ab,19c01200d7002100b81145a3ce6103e9,fcc01200d7002100b81145a3ce61035b,….\n```\n\n## PASnapshot - getCompareQuery\\(String sys\\_id, Number date1, Number date2, String type\\)\n\nReturns the query used to compare records in snapshots for a specified indicator at multiple dates.\n\n<table id=\"table_tgw_sbq_nw\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nsys\\_id\n\n</td><td>\n\nString\n\n</td><td>\n\nIndicator's sys\\_id.\n\n</td></tr><tr><td>\n\ndate1\n\n</td><td>\n\nNumber\n\n</td><td>\n\nDate of the first snapshot.Format: yyyymmdd\n\n</td></tr><tr><td>\n\ndate2\n\n</td><td>\n\nNumber\n\n</td><td>\n\nDate of the second snapshot.Format: yyyymmdd\n\n</td></tr><tr><td>\n\ntype\n\n</td><td>\n\nString\n\n</td><td>\n\nSpecifies what data to retrieve.Valid values:\n\n-   all1: all records in the first snapshot\n-   all2: all records in the second snapshot\n-   shared: records that are in both snapshots\n-   movedin: records that are in the second snapshot, but not the first\n-   movedout: records that are in the first snapshot, but not the second\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|String|The table, view, and encoded query as a JSON string.|\n\n```\nvar snapshot4 = PASnapshot.getCompareQuery('fb007202d7130100b96d45a3ce6103b4', 20160530, 20160531, 'all1');\ngs.info(snapshot4);\n\n```\n\nOutput:\n\n```\n*** Script: {\n  \"view\":\"\",\n  \"query\":\"sys_idINjavascript:new PAUtils().getCompareSnapshotIDs(\\\"fb007202d7130100b96d45a3ce6103b4\\\",\n  \\\"20160530\\\",\n  \\\"20160531\\\",\n  \\\"all1\\\")\",\n  \"table\":\"incident\"\n}\n```\n\n## PASnapshot - getIDs\\(String sys\\_id, Number date\\)\n\nReturns the sys\\_id values for all records contained in the snapshot for a specified indicator at the specified date.\n\n<table id=\"table_knc_xbq_nw\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nsys\\_id\n\n</td><td>\n\nString\n\n</td><td>\n\nIndicator's sys\\_id.\n\n</td></tr><tr><td>\n\ndate\n\n</td><td>\n\nNumber\n\n</td><td>\n\nDate when the snapshot was taken.Format: yyyymmdd\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|String|A comma-separated list of sys\\_id values.|\n\n```\nvar snapshot1 = PASnapshot.getIDs('fb007202d7130100b96d45a3ce6103b4', 20160530);\ngs.info(snapshot1);\n```\n\nOutput:\n\n```\n*** Script: 09c01200d7002100b81145a3ce6103ab,19c01200d7002100b81145a3ce6103e9,fcc01200d7002100b81145a3ce61035b,….\n```\n\n## PASnapshot - getQuery\\(String sys\\_id, Number date\\)\n\nReturns the query used to generate the snapshot for a specified indicator at the specified date.\n\n<table id=\"table_pth_pbq_nw\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nsys\\_id\n\n</td><td>\n\nString\n\n</td><td>\n\nIndicator's sys\\_id.\n\n</td></tr><tr><td>\n\ndate\n\n</td><td>\n\nNumber\n\n</td><td>\n\nDate the snapshot was taken.Format: yyyymmdd\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|String|The table, view, and encoded query as a JSON string.|\n\n```\nvar snapshot3 = PASnapshot.getQuery('fb007202d7130100b96d45a3ce6103b4', 20160530);\ngs.info(snapshot3);\n```\n\nOutput:\n\n```\n*** Script: {\n  \"view\":\"\",\n  \"query\":\"sys_idINjavascript:new PAUtils().getSnapshotIDs(\\\"fb007202d7130100b96d45a3ce6103b4\\\",\n  \\\"20160530\\\")\",\n  \"table\":\"incident\"\n}\n```\n\n"}}