{"info":{"_postman_id":"6b105492-b673-46bd-a673-803f42a4fe6e","name":"SOS2021-09-performances-by-degrees-us","description":"<html><head></head><body><h1 id=\"introduction\">Introduction</h1>\n<p>API que permite obtener el rendimiento en creditos de los alumnos de los diferentes centros de la US</p>\n<h1 id=\"error-codes\">Error Codes</h1>\n<p>Se sigue el modelo de REST API.</p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[{"content":"Introduction","slug":"introduction"},{"content":"Error Codes","slug":"error-codes"}],"owner":"15037183","collectionId":"6b105492-b673-46bd-a673-803f42a4fe6e","publishedId":"TzRLmWbS","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2021-05-02T12:30:09.000Z"},"item":[{"name":"Get API info","event":[{"listen":"test","script":{"exec":["pm.test(\"Status code is 200\", function(){","    pm.response.to.have.status(200);","});","","pm.test(\"Content is OK\", function(){","    pm.response.to.have.body('<html><h3>performances-by-degrees-us</h3>Estudia el rendimiento de los alumnos comparando los créditos matriculados frente a los completados segun año y centro.<p></p><table class=\"table table-bordered table-hover table-condensed\"> <thead><tr><th title=\"Field #1\">field-of-knowledge</th> <th title=\"Field #2\">year</th> <th title=\"Field #3\">performance-percents</th> <th title=\"Field #4\">credits-passed</th> <th title=\"Field #5\">credits-enrolled</th> <th title=\"Field #6\">center</th> </tr></thead> <tbody><tr> <td>History</td> <td align=\"right\">2018</td> <td>83,44%</td> <td>2006</td> <td>2404</td> <td>FHISTRY</td> </tr> <tr> <td>Computer-Science</td> <td align=\"right\">2018</td> <td>87,10%</td> <td>1870</td> <td>2147</td> <td>ETSII</td> </tr> <tr> <td>Graography</td> <td align=\"right\">2018</td> <td>88,24%</td> <td>2010</td> <td>2278</td> <td>FHISTRY</td> </tr> <tr> <td>Art</td> <td align=\"right\">2018</td> <td>77,69%</td> <td>390</td> <td>502</td> <td>FBBAA</td> </tr> <tr> <td>Nursering</td> <td align=\"right\">2018</td> <td>87,93%</td> <td>1551</td> <td>1764</td> <td>FEFP</td> </tr> <tr> <td>Phychology</td> <td align=\"right\">2018</td> <td>83,21%</td> <td>2567,5</td> <td>3085,5</td> <td>FPSYCHOLOGY</td> </tr> <tr> <td>Engineering</td> <td align=\"right\">2018</td> <td>77,45%</td> <td>1882</td> <td>2430</td> <td>EPS</td> </tr> <tr> <td>Maths</td> <td align=\"right\">2018</td> <td>109,70%</td> <td>1188</td> <td>1083</td> <td>FMATHS</td> </tr> <tr> <td>Medicine</td> <td align=\"right\">2018</td> <td>74,45%</td> <td>1850</td> <td>2485</td> <td>FMEDICINE</td> </tr> </tbody></table></html>');","});"],"type":"text/javascript","id":"bdd4521d-0e12-41c2-8416-87e505528e41"}}],"id":"b2461f4d-04e0-44fb-8532-b986f60eff40","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://127.0.0.1:3000/info/performances-by-degrees-us","urlObject":{"path":["info","performances-by-degrees-us"],"host":["http://127.0.0.1:3000"],"query":[],"variable":[]}},"response":[],"_postman_id":"b2461f4d-04e0-44fb-8532-b986f60eff40"},{"name":"Load initial data","event":[{"listen":"test","script":{"exec":["pm.test(\"Status Code\", function() {","    pm.expect(pm.response.code).to.be.oneOf([200, 201])","});"],"type":"text/javascript","id":"029201cb-0790-4269-aa42-4b92a0abdc3f"}}],"id":"193ae6e3-9f23-4778-957a-1c25a560100f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://127.0.0.1:3000/api/v1/performances-by-degrees-us/loadInitialData","urlObject":{"path":["api","v1","performances-by-degrees-us","loadInitialData"],"host":["http://127.0.0.1:3000"],"query":[],"variable":[]}},"response":[],"_postman_id":"193ae6e3-9f23-4778-957a-1c25a560100f"},{"name":"Search Data","event":[{"listen":"test","script":{"exec":["pm.test(\"Status Code\", function() {","    pm.response.to.have.status(200);","});","","pm.test(\"Is not empty\", function(){","    pm.expect(pm.response.json().length).greaterThan(0);","});","","pm.test(\"Documents are valid\", function(){","    pm.expect(isValidData(pm.response.json())).equals(true);","});","","pm.sendRequest(pm.variables.get(\"HOST\") + \"/api/v1/performances-by-degrees-us/?limit=1\", function (err, response) {","    pm.test(\"Limit 1 document\", function(){","        pm.expect(response.json().length).equals(1);","    });","});","","pm.sendRequest(pm.variables.get(\"HOST\") + \"/api/v1/performances-by-degrees-us/?year=\" + pm.response.json()[0][\"year\"], function (err, response) {","    pm.test(\"Documents by year\", function(){","        let resp = response.json();","        let year = pm.response.json()[0][\"year\"];","        for(let element in resp){","            pm.expect(resp[element][\"year\"]).equals(year);","        }","    });","});","","function isValidData(d){","    if(!Array.isArray(d)) return validDataRow(d);","","    for(let element in d){","        if(!validDataRow(d[element])) return false;","    }","","    return true;","}","","function validDataRow(d){","    if(Object.keys(d).length !== 6) return false;","    if (!d[\"field-of-knowledge\"]) return false;","    if (!d.year) return false;","    if (!d[\"performance-percents\"]) return false;","    if (!d[\"credits-passed\"]) return false;","    if (!d[\"credits-enrolled\"]) return false;","    if (!d[\"center\"]) return false;","    return true;","}"],"type":"text/javascript","id":"a9d473f0-8288-4da2-a028-a582cee101ec"}}],"id":"f1115011-0d47-411b-bf9c-60cd5c7ccb7d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://127.0.0.1:3000/api/v1/performances-by-degrees-us/","urlObject":{"path":["api","v1","performances-by-degrees-us",""],"host":["http://127.0.0.1:3000"],"query":[{"disabled":true,"key":"offset","value":"1"},{"disabled":true,"key":"limit","value":"1"},{"disabled":true,"key":"center","value":"ETSII"},{"disabled":true,"key":"credits-passed","value":"1870"},{"disabled":true,"key":"credits-enrolled","value":"2147"},{"disabled":true,"key":"field-of-knowledge","value":"Computer-Science"},{"disabled":true,"key":"year","value":"2018"}],"variable":[]}},"response":[],"_postman_id":"f1115011-0d47-411b-bf9c-60cd5c7ccb7d"},{"name":"Modify Record","event":[{"listen":"test","script":{"exec":["pm.sendRequest({","    url: pm.variables.get(\"HOST\") + \"/api/v1/performances-by-degrees-us/\",","    method: 'POST',","    header: {","        'content-type': 'application/json'","    },","    body: {","        mode: 'raw',","        raw: JSON.stringify({ \"field-of-knowledge\": \"PruebaPOSTMAN2\", \"year\": 5555, \"performance-percents\": \"0\", \"credits-passed\": 1870, \"credits-enrolled\": 2147, \"center\": \"FHISTRY\" })","    }","}, function (err, res) {","            pm.sendRequest({","            url: pm.variables.get(\"HOST\") + \"/api/v1/performances-by-degrees-us/FHISTRY/5555/PruebaPOSTMAN2\",","            method: 'PUT',","            header: {","            'content-type': 'application/json'","            },","            body: {","                mode: 'raw',","                raw: JSON.stringify({ \"field-of-knowledge\": \"FuncionaPOSTMAN\", \"year\": 5555, \"performance-percents\": \"0\", \"credits-passed\": 1870, \"credits-enrolled\": 2147, \"center\": \"FHISTRY\" })","            }","        }, function (err, res) {","            pm.test(\"Modify one record\", function(){","                pm.expect(res.code).equals(200);","            });","        });","});","","pm.sendRequest({","    url: pm.variables.get(\"HOST\") + \"/api/v1/performances-by-degrees-us/FHISTRY/5555/PruebaPOSTMAN2\",","    method: 'PUT',","    header: {","    'content-type': 'application/json'","    },","    body: {","        mode: 'raw',","        raw: JSON.stringify({ \"field-of-knowledge\": \"FuncionaPOSTMAN\"})","    }","    }, function (err, res) {","    pm.test(\"Invalid modification\", function(){","        pm.expect(res.code).equals(400);","    });","});"],"type":"text/javascript","id":"123241f3-6b61-4c0f-b828-70c56bc63738"}}],"id":"1105f62c-b061-48e8-9c34-f13c2d372315","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\n    \"field-of-knowledge\": \"Histor22y\",\n    \"year\": 2018,\n    \"performance-percents\": \"83.44%\",\n    \"credits-passed\": 2006,\n    \"credits-enrolled\": 2404,\n    \"center\": \"FHISTRY\"\n}","options":{"raw":{"language":"json"}}},"url":"http://127.0.0.1:3000/api/v1/performances-by-degrees-us/FHISTRY/2018/History","urlObject":{"path":["api","v1","performances-by-degrees-us","FHISTRY","2018","History"],"host":["http://127.0.0.1:3000"],"query":[],"variable":[]}},"response":[],"_postman_id":"1105f62c-b061-48e8-9c34-f13c2d372315"},{"name":"Add Data","event":[{"listen":"test","script":{"exec":["pm.test(\"Add Multiple elements\", function(){","        pm.response.to.have.status(201);","});","","pm.sendRequest({","    url: pm.variables.get(\"HOST\") + \"/api/v1/performances-by-degrees-us/\",","    method: 'POST',","    header: {","        'content-type': 'application/json'","    },","    body: {","        mode: 'raw',","        raw: JSON.stringify({ year: 2055})","    }","}, function (err, res) {","    pm.test(\"Add invalid element\", function(){","            pm.expect(res.code).equals(400);","    });","});"],"type":"text/javascript","id":"5d8d351d-a19c-4dd0-be89-1ff9edecc030"}}],"id":"d5769f61-a1e8-4925-a261-aba815f9140e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"[{\n        \"field-of-knowledge\": \"ewjjjjjjjr\",\n        \"year\": 2019,\n        \"performance-percents\": \"87.10%\",\n        \"credits-passed\": 1870,\n        \"credits-enrolled\": 2147,\n        \"center\": \"FHISTRY\"\n},\n{\n        \"field-of-knowledge\": \"Prueba5\",\n        \"year\": 2019,\n        \"performance-percents\": \"87.10%\",\n        \"credits-passed\": 1870,\n        \"credits-enrolled\": 2147,\n        \"center\": \"FHISTRY\"\n}]","options":{"raw":{"language":"json"}}},"url":"http://127.0.0.1:3000/api/v1/performances-by-degrees-us/","urlObject":{"path":["api","v1","performances-by-degrees-us",""],"host":["http://127.0.0.1:3000"],"query":[],"variable":[]}},"response":[],"_postman_id":"d5769f61-a1e8-4925-a261-aba815f9140e"},{"name":"PUT to collection (Invalid)","event":[{"listen":"test","script":{"exec":["pm.test(\"Status code is 405\", function(){","    pm.response.to.have.status(405);","});"],"type":"text/javascript","id":"16763f07-9c57-4389-86ce-d5e9c25d16da"}}],"id":"d62a35c1-1de2-4d32-b192-5fd5e976c9f7","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"url":"http://127.0.0.1:3000/api/v1/performances-by-degrees-us/","urlObject":{"path":["api","v1","performances-by-degrees-us",""],"host":["http://127.0.0.1:3000"],"query":[],"variable":[]}},"response":[],"_postman_id":"d62a35c1-1de2-4d32-b192-5fd5e976c9f7"},{"name":"POST to element (Invalid)","event":[{"listen":"test","script":{"exec":["pm.test(\"Status code is 405\", function(){","    pm.response.to.have.status(405);","});"],"type":"text/javascript","id":"5b96301f-40bf-4eba-8faf-1bbc1f27aebf"}}],"id":"ea609b45-6029-48d6-9a19-3234b90dc381","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"url":"http://127.0.0.1:3000/api/v1/performances-by-degrees-us/FHISTRY/2018/History","urlObject":{"path":["api","v1","performances-by-degrees-us","FHISTRY","2018","History"],"host":["http://127.0.0.1:3000"],"query":[],"variable":[]}},"response":[],"_postman_id":"ea609b45-6029-48d6-9a19-3234b90dc381"},{"name":"Delete one record","event":[{"listen":"test","script":{"exec":["pm.sendRequest({","    url: pm.variables.get(\"HOST\") + \"/api/v1/performances-by-degrees-us/\",","    method: 'POST',","    header: {","        'content-type': 'application/json'","    },","    body: {","        mode: 'raw',","        raw: JSON.stringify({ \"field-of-knowledge\": \"PruebaPOSTMAN\", \"year\": 5555, \"performance-percents\": \"0\", \"credits-passed\": 1870, \"credits-enrolled\": 2147, \"center\": \"FHISTRY\" })","    }","}, function (err, res) {","    pm.sendRequest({","        url: pm.variables.get(\"HOST\") + \"/api/v1/performances-by-degrees-us/FHISTRY/5555/PruebaPOSTMAN\",","        method: 'DELETE'","    }, function (err, res) {","        pm.test(\"Delete one record\", function(){","            pm.expect(res.code).equals(200);","        });","    });","});"],"type":"text/javascript","id":"3472f73a-6c81-4b1e-af0a-f0eff240fd15"}}],"id":"d2d333eb-bcf8-48ed-b410-338fc2c4ec42","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[],"url":"http://127.0.0.1:3000/api/v1/performances-by-degrees-us/FHISTRY/2019/Prueba","urlObject":{"path":["api","v1","performances-by-degrees-us","FHISTRY","2019","Prueba"],"host":["http://127.0.0.1:3000"],"query":[],"variable":[]}},"response":[],"_postman_id":"d2d333eb-bcf8-48ed-b410-338fc2c4ec42"},{"name":"Delete All Records","event":[{"listen":"test","script":{"exec":["pm.test(\"Delete All Data\", function(){","    pm.response.to.have.status(200);","});"],"type":"text/javascript","id":"6df6f476-11ee-4762-b853-c13ad0f63abf"}}],"id":"f8eb5029-4643-4fd6-b68a-a4e4b2f09050","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[],"url":"http://127.0.0.1:3000/api/v1/performances-by-degrees-us/","urlObject":{"path":["api","v1","performances-by-degrees-us",""],"host":["http://127.0.0.1:3000"],"query":[],"variable":[]}},"response":[],"_postman_id":"f8eb5029-4643-4fd6-b68a-a4e4b2f09050"}],"event":[{"listen":"prerequest","script":{"type":"text/javascript","exec":[""],"id":"8d0872be-ba8f-4453-aa39-e7bc8da8e8db"}},{"listen":"test","script":{"type":"text/javascript","exec":[""],"id":"5f37c74b-ec46-47c3-969d-c2cb69d14c03"}}],"variable":[{"key":"HOST","value":"http://127.0.0.1:3000"}]}