{"id":2692,"date":"2023-12-20T18:50:28","date_gmt":"2023-12-20T18:50:28","guid":{"rendered":"https:\/\/developers.maplink.global\/building-requests-for-the-distance-matrix-api\/"},"modified":"2024-03-01T20:29:25","modified_gmt":"2024-03-01T20:29:25","slug":"building-requests-for-the-distance-matrix-api","status":"publish","type":"post","link":"https:\/\/developers.maplink.global\/en\/building-requests-for-the-distance-matrix-api\/","title":{"rendered":"Building requests for the Distance Matrix API"},"content":{"rendered":"\n<p>Before you can start using the API, you will need to <a href=\"https:\/\/developers.maplink.global\/en\/how-do-i-generate-the-token-for-authentication\/\" data-type=\"post\" data-id=\"999\">obtain the <em>authentication token<\/em><\/a>. <\/p>\n\n<p>The following <em>headers <\/em>will be required, where the word <strong><em>token <\/em><\/strong>must be replaced by the token obtained in the authentication process:<\/p>\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">--header 'Content-Type: application\/json' \\\n--header 'Authorization: Bearer token'<\/pre>\n\n<p>All the parameters to solve the distance matrix calculation will be sent in <em>body <\/em>.<\/p>\n\n<p>The Distance Matrix API works <strong>asynchronously<\/strong>. In other words, an ID will be returned when the problem is sent. With this ID you can check the response in the future or the processing status.<\/p>\n\n<p>The API has the following endpoints, where the term <code>{{matrixId}}<\/code> must be replaced by the ID of the problem to be consulted:<\/p>\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/api.maplink.global\/matrix\/v1\/problems\">https:\/\/api.maplink.global\/matrix\/v1\/problems<\/a> &#8211; <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">POST<\/mark><\/strong><br\/>Used to send the logistics problem. An ID will be returned for the query.<br\/><\/li>\n\n\n\n<li><a href=\"https:\/\/api.maplink.global\/matrix\/v1\/events?jobId=%7B%7BmatrixID%7D%7D\">https:\/\/api.maplink.global\/matrix\/v1\/events?jobId={{matrixID}}<\/a> &#8211; <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">GET<\/mark><\/strong><br\/>Returns all the states from the time the request was received until its completion.<br\/><\/li>\n\n\n\n<li><a href=\"https:\/\/api.maplink.global\/matrix\/v1\/jobs\/%7B%7BmatrixID%7D%7D\">https:\/\/api.maplink.global\/matrix\/v1\/jobs\/{{matrixID}}<\/a> &#8211; <strong><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">GET<\/mark><\/strong><\/strong><br\/>Returns the current processing status of the request.<br\/><\/li>\n\n\n\n<li><a href=\"https:\/\/api.maplink.global\/matrix\/v1\/solutions\/%7B%7BmatrixId%7D%7D\">https:\/\/api.maplink.global\/matrix\/v1\/solutions\/{{matrixId}}<\/a> &#8211; <strong><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">GET<\/mark><\/strong><\/strong><br\/>Returns the result of the distance matrix.<\/li>\n<\/ul>\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><\/p>\n<cite><strong>Note<\/strong>: Solution IDs are available for consultation for a period of <strong>7 days<\/strong>.<\/cite><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Before you can start using the API, you will need to obtain the authentication token. The following headers will be required, where the word token must be replaced by the token obtained in the authentication process: All the parameters to solve the distance matrix calculation will be sent in body . The Distance Matrix API [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[165],"tags":[],"class_list":["post-2692","post","type-post","status-publish","format-standard","hentry","category-distance-matrix-en"],"acf":[],"_links":{"self":[{"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/posts\/2692","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/comments?post=2692"}],"version-history":[{"count":1,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/posts\/2692\/revisions"}],"predecessor-version":[{"id":2693,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/posts\/2692\/revisions\/2693"}],"wp:attachment":[{"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/media?parent=2692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/categories?post=2692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/tags?post=2692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}