-
Notifications
You must be signed in to change notification settings - Fork 0
/
8fff7543.51dec577.js
1 lines (1 loc) · 13.7 KB
/
8fff7543.51dec577.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[86],{186:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return i})),n.d(t,"metadata",(function(){return c})),n.d(t,"rightToc",(function(){return s})),n.d(t,"default",(function(){return b}));var a=n(2),r=n(6),o=(n(0),n(250)),i={id:"InterpretandoErros",title:"Interpretando Erros na API",hide_title:!0,sidebar_label:"Interpreting API Errors"},c={id:"VisaoGeral/InterpretandoErros",isDocsHomePage:!1,title:"Interpretando Erros na API",description:"Interpreting API Errors",source:"@site/docs\\VisaoGeral\\InterpretandoErros.md",permalink:"/documentation/docs/VisaoGeral/InterpretandoErros",sidebar_label:"Interpreting API Errors",sidebar:"someSidebar",previous:{title:"Tipos de Integra\xe7\xf5es",permalink:"/documentation/docs/VisaoGeral/tiposIntegracao"},next:{title:"Limites de Consumo",permalink:"/documentation/docs/VisaoGeral/LimitesConsumo"}},s=[{value:"Learning to use the "Request History" of the Gerencianet API",id:"learning-to-use-the-request-history-of-the-gerencianet-api",children:[{value:"Example 1 - Create transaction/charge",id:"example-1---create-transactioncharge",children:[]},{value:"Example 2 - Link to payment method",id:"example-2---link-to-payment-method",children:[]},{value:"Exemplo 3 - Create carnet",id:"exemplo-3---create-carnet",children:[]}]},{value:"Learning to search the error codes of the Gerencianet API",id:"learning-to-search-the-error-codes-of-the-gerencianet-api",children:[{value:"(+) HTTP status codes (2xx, 3xx, 4xx and 5xx)",id:"-http-status-codes-2xx-3xx-4xx-and-5xx",children:[]},{value:"(+) "Notification History" tab",id:"-notification-history-tab",children:[]}]}],l={rightToc:s};function b(e){var t=e.components,n=Object(r.a)(e,["components"]);return Object(o.b)("wrapper",Object(a.a)({},l,n,{components:t,mdxType:"MDXLayout"}),Object(o.b)("h1",{className:"titulo"},"Interpreting API Errors"),Object(o.b)("div",{className:"subtitulo"},Object(o.b)("p",null,'This page aims to present the "Request History", which allows the integrator to view all requests made by their application to the Gerencianet API. Thus, you will learn to interpret API returns and, of course, correct possible data validation errors or similar ones and identify consumptions/requests made by your application to our ',Object(o.b)("em",{parentName:"p"},"webservices"),"."),Object(o.b)("br",null),Object(o.b)("h2",{id:"learning-to-use-the-request-history-of-the-gerencianet-api"},'Learning to use the "Request History" of the Gerencianet API'),Object(o.b)("p",null,"The API validates the data contained in the request that the integrated system sends to our ",Object(o.b)("em",{parentName:"p"},"webservices.")," In this way, depending on the endpoint your system is trying to consume, errors may be returned in certain situations. This also applies if you use a ",Object(o.b)("a",{href:"https://gerencianet.com.br/artigo/sistemas-integrados/",target:"_blank"},"system or module")," que have integration with Gerencianet."),Object(o.b)("p",null,'To access the "Request History", follow the steps:'),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},Object(o.b)("a",{href:"https://gerencianet.com.br/#login",target:"_blank",title:"Link Externo"},"log in")," in your Gerencianet account;"),Object(o.b)("li",{parentName:"ul"},"Access ",Object(o.b)("code",null,"API > Minhas Aplica\xe7\xf5es > Sua Aplica\xe7\xe3o"),";"),Object(o.b)("li",{parentName:"ul"},"Choose the environment used (production or development) and click on ",Object(o.b)("code",null,"Hist\xf3rico de Requisi\xe7\xf5es")," (",Object(o.b)("a",{href:"https://s3-sa-east-1.amazonaws.com/pe85007/portal/wp-content/uploads/2018/08/14133035/Historico-Requisicoes-API-Gerencianet.png",target:"_blank"},"see where"),").")),Object(o.b)("p",null,'Check out the video where we teach you how to use the "Hist\xf3rico de Requisi\xe7\xf5es" of the API:'),Object(o.b)("iframe",{width:"560",height:"315",src:"https://www.youtube.com/embed/ad0SYoeGAZs",frameborder:"0",allowfullscreen:!0}),Object(o.b)("p",null,"The following are some common examples of errors returned by the API due to some data not being in the correct format."),Object(o.b)("div",{className:"admonition admonition-important alert alert--info"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"important")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"The following examples are also applicable if you are using a ",Object(o.b)("a",{href:"https://gerencianet.com.br/artigo/sistemas-integrados/",target:"_blank"},"system or module"),' that is already integrated with Gerencianet, after all, it is the API that is "behind" taking care of requests.'))),Object(o.b)("br",null),Object(o.b)("h3",{id:"example-1---create-transactioncharge"},"Example 1 - Create transaction/charge"),Object(o.b)("p",null,"When sending a ",Object(o.b)("code",null,"POST")," to the route ",Object(o.b)("code",null,"/v1/charge"),', the integrator will be creating a charge (or "transaction") with the status ',Object(o.b)("code",null,"new"),",that is, the charge has been generated and is waiting for the payment method to be defined."),Object(o.b)("p",null,"When creating a transaction, you can define, for example: item name, value, if it is a marketplace item, if it has shipping, inform a notification URL, etc."),Object(o.b)("p",null,"For this example, let's try to create a charge whose total amount is less than R$ 5,00:"),Object(o.b)("p",null,Object(o.b)("img",Object(a.a)({parentName:"p"},{src:"../../img/exemplo1.png",alt:"alt text",title:"Create_Charge"}))),Object(o.b)("p",null,'Now, after sending the code above, go through the "Hist\xf3rico de Requisi\xe7\xf5es" tab to check the response provided by the API:'),Object(o.b)("p",null,Object(o.b)("img",Object(a.a)({parentName:"p"},{src:"../../img/exemplo2.png",alt:"alt text",title:"Failure"}))),Object(o.b)("p",null,"As you can see in the image above, the response has ",Object(o.b)("code",null,"code")," different from ",Object(o.b)("code",null,"200"),", that is, the consumption was not successful. In this case, the API requires the minimum amount of a charge to be R$ 5,00 - so in this case you must provide ",Object(o.b)("code",null,"500"),", without semicolons or semicolons (remembering that ",Object(o.b)("code",null,"500")," is equivalent to R$ 5,00)."),Object(o.b)("br",null),Object(o.b)("h3",{id:"example-2---link-to-payment-method"},"Example 2 - Link to payment method"),Object(o.b)("p",null,"When sending a ",Object(o.b)("code",null,"POST")," to the ",Object(o.b)("code",null,"/v1/charge/:id/pay")," route, where ",Object(o.b)("code",null,":id")," is the ",Object(o.b)("code",null,"charge_id")," > of the desired transaction, the integrator will be associating the charge to a payment method."),Object(o.b)("p",null,"At this point, you can define, for example: end customer data, address, expiration date (in case of a boleto), if there is a discount, if there is a fine/interest charge after the expiration date, etc."),Object(o.b)("p",null,'For this example, we\'ll try to associate a charge with the payment method "boleto banc\xe1rio" and with a due date in a format not supported by the API:'),Object(o.b)("p",null,Object(o.b)("img",Object(a.a)({parentName:"p"},{src:"../../img/exemplo3.png",alt:"alt text",title:"Associate_Payment"}))),Object(o.b)("p",null,'Now, after sending the code above, go through the "Hist\xf3rico de Requisi\xe7\xf5es" tab to check the response provided by the API:'),Object(o.b)("p",null,Object(o.b)("img",Object(a.a)({parentName:"p"},{src:"../../img/exemplo4.png",alt:"alt text",title:"Failure"}))),Object(o.b)("p",null,"As you can see in the image above, the response has ",Object(o.b)("code",null,"code")," different from ",Object(o.b)("code",null,"200"),", that is, the consumption was not successful. In this case, the carn\xea must have a maximum of 12 (twelve) installments."),Object(o.b)("br",null),Object(o.b)("h3",{id:"exemplo-3---create-carnet"},"Exemplo 3 - Create carnet"),Object(o.b)("p",null,"When sending a ",Object(o.b)("code",null,"POST")," to the route ",Object(o.b)("code",null,"/v1/carnet"),", the integrator will be creating a carnet with the settings you defined."),Object(o.b)("p",null,"At this time, you can define, for example: item name, value, quantity, customer data, address, number of installments, due date, etc."),Object(o.b)("p",null,"For this example, let's try to create a 20 installment carn\xea:"),Object(o.b)("p",null,Object(o.b)("img",Object(a.a)({parentName:"p"},{src:"../../img/exemplo5.png",alt:"alt text",title:"Create_Carn\xea"}))),Object(o.b)("p",null,"Now, after sending the code above, go through the ",Object(o.b)("em",{parentName:"p"},'"Hist\xf3rico de Requisi\xe7\xf5es"')," tab to check the response provided by the API:"),Object(o.b)("p",null,Object(o.b)("img",Object(a.a)({parentName:"p"},{src:"../../img/exemplo6.png",alt:"alt text",title:"Failure"}))),Object(o.b)("p",null,"As you can see in the image above, the response has ",Object(o.b)("code",null,"code")," different from ",Object(o.b)("code",null,"200"),", that is, the consumption was not successful. In this case, the carn\xea must have a maximum of 12 (twelve) installments."),Object(o.b)("br",null),Object(o.b)("h2",{id:"learning-to-search-the-error-codes-of-the-gerencianet-api"},"Learning to search the error codes of the Gerencianet API"),Object(o.b)("p",null,"Seeking to facilitate the understanding of each error returned by our APIs, we provide a page that aims to present a list of all errors for consultation.\nTo access it, click ",Object(o.b)("a",{href:"https://gerencianet.github.io/gn-erros-api/",target:"_blank",title:"Link Externo"},Object(o.b)("b",null,"this link")),"."),Object(o.b)("p",null,Object(o.b)("img",Object(a.a)({parentName:"p"},{src:"../../img/consultando_error_exemplo.gif",alt:"alt text",title:"Searching for errors description"}))),Object(o.b)("br",null),Object(o.b)("h3",{id:"-http-status-codes-2xx-3xx-4xx-and-5xx"},"(+) HTTP status codes (2xx, 3xx, 4xx and 5xx)"),Object(o.b)("p",null,"Gerencianet uses HTTP responses to indicate success or failure in requests. Commonly, when we return responses with status ",Object(o.b)("code",null,"2xx")," it means that the request was successful; ",Object(o.b)("code",null,"3xx")," status indicates redirection; status ",Object(o.b)("code",null,"4xx")," indicates failures in sending data from the client; status ",Object(o.b)("code",null,"5xx")," indicates internal server errors."),Object(o.b)("p",null,"If you want, check ",Object(o.b)("a",Object(a.a)({parentName:"p"},{href:"../Notificacoes/FluxoNotificacoes#c%C3%B3digos-de-status-http-2xx-3xx-4xx-e-5xx"}),"this link")," a table showing the HTTP codes of the most common responses, as well as their explanations and solutions."),Object(o.b)("br",null),Object(o.b)("h3",{id:"-notification-history-tab"},'(+) "Notification History" tab'),Object(o.b)("p",null,"This feature is available in the API of your Gerencianet account and allows you to view the POSTs that Gerencianet fires to the notification URL defined by the integrator. ",Object(o.b)("a",Object(a.a)({parentName:"p"},{href:"../Notificacoes/FluxoNotificacoes"}),"Saiba mais"),".")))}b.isMDXComponent=!0},250:function(e,t,n){"use strict";n.d(t,"a",(function(){return u})),n.d(t,"b",(function(){return d}));var a=n(0),r=n.n(a);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=r.a.createContext({}),b=function(e){var t=r.a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},u=function(e){var t=b(e.components);return r.a.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.a.createElement(r.a.Fragment,{},t)}},h=r.a.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=b(n),h=a,d=u["".concat(i,".").concat(h)]||u[h]||p[h]||o;return n?r.a.createElement(d,c(c({ref:t},l),{},{components:n})):r.a.createElement(d,c({ref:t},l))}));function d(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=h;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var l=2;l<o;l++)i[l]=n[l];return r.a.createElement.apply(null,i)}return r.a.createElement.apply(null,n)}h.displayName="MDXCreateElement"}}]);