{"id":2961,"date":"2021-07-31T13:00:00","date_gmt":"2021-07-31T12:00:00","guid":{"rendered":"https:\/\/chewett.co.uk\/blog\/?p=2961"},"modified":"2021-07-31T15:15:02","modified_gmt":"2021-07-31T14:15:02","slug":"enabling-cross-origin-resource-sharing-cors-on-pogoapi-net","status":"publish","type":"post","link":"https:\/\/chewett.co.uk\/blog\/2961\/enabling-cross-origin-resource-sharing-cors-on-pogoapi-net\/","title":{"rendered":"Enabling Cross-Origin Resource Sharing (CORS) on PoGoAPI.net"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"678\" height=\"254\" data-attachment-id=\"2965\" data-permalink=\"https:\/\/chewett.co.uk\/blog\/2961\/enabling-cross-origin-resource-sharing-cors-on-pogoapi-net\/pogoapi_cors_header\/\" data-orig-file=\"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2021\/07\/pogoapi_cors_header.jpg?fit=800%2C300&amp;ssl=1\" data-orig-size=\"800,300\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"pogoapi_cors_header\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2021\/07\/pogoapi_cors_header.jpg?fit=300%2C113&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2021\/07\/pogoapi_cors_header.jpg?fit=678%2C254&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2021\/07\/pogoapi_cors_header.jpg?resize=678%2C254&#038;ssl=1\" alt=\"\" class=\"wp-image-2965\" srcset=\"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2021\/07\/pogoapi_cors_header.jpg?w=800&amp;ssl=1 800w, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2021\/07\/pogoapi_cors_header.jpg?resize=300%2C113&amp;ssl=1 300w, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2021\/07\/pogoapi_cors_header.jpg?resize=768%2C288&amp;ssl=1 768w, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2021\/07\/pogoapi_cors_header.jpg?resize=50%2C19&amp;ssl=1 50w\" sizes=\"auto, (max-width: 678px) 100vw, 678px\" \/><\/figure>\n\n\n\n<p>This blog post talks about enabling Cross-Origin Resource Sharing (CORS) on PoGoAPI.net<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">What is CORS (Cross-Origin Resource Sharing)<\/h2>\n\n\n\n<p>Cross-Origin Resource Sharing defines whether a browser can load resources from other origins different from the one that it is currently loading.<\/p>\n\n\n\n<p>By default browsers will only load resources from the same origin, which means you are unable to load resources from another domain even if it something else you run.<\/p>\n\n\n\n<p>Cross-Origin Resource Sharing allows defining a header which tells a browser what origins the resource may be loaded from, if it not the current origin.<\/p>\n\n\n\n<p>This can allow browsers to access resources from different domains or ports than the primary one it is using.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Cross-Origin Resource Sharing is now enabled on PoGoAPI.net<\/h2>\n\n\n\n<p>Someone contacted me asking if I could enable Cross-Origin Resource Sharing and after speaking with them I agreed!<\/p>\n\n\n\n<p>This should mean that you can load the resources from a browser without having to bypass the Cross-Origin Resource Sharing header. Although we still recommend using <a rel=\"noreferrer noopener\" href=\"https:\/\/chewett.co.uk\/blog\/2162\/pokemon-go-api-api-hashes-api\/\" data-type=\"URL\" data-id=\"https:\/\/chewett.co.uk\/blog\/2162\/pokemon-go-api-api-hashes-api\/\" target=\"_blank\">the hashes API<\/a> to ensure you only pull the data when it has changed.<\/p>\n\n\n\n<p>As usual, if there is anything else you think should be changed, feel free to contact me!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This blog post talks about enabling Cross-Origin Resource Sharing (CORS) on PoGoAPI.net<\/p>\n","protected":false},"author":1,"featured_media":2964,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"As a FYI, I have enabled Cross-Origin Resource Sharing (CORS) on the #PokemonGo #API PoGoAPI.net .","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[98],"tags":[226,227,224,223,218,225],"class_list":["post-2961","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-api","tag-open-data","tag-pogoapi","tag-pokemon","tag-pokemon-go","tag-pokemon-go-api"],"wppr_data":{"cwp_meta_box_check":"No"},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2021\/07\/pogoapi_cors_posticon.png?fit=1200%2C628&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p2toWX-LL","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1533,"url":"https:\/\/chewett.co.uk\/blog\/1533\/pokemon-go-api-available-nesting-pokemon-changed\/","url_meta":{"origin":2961,"position":0},"title":"Pokemon Go API &#8211; Available Nesting Pokemon Changed","author":"Chewett","date":"September 19, 2018","format":false,"excerpt":"This post talks about the most recent nesting Pokemon Changes and the changes that have been made to pogoapi.net. What has changed with the nests? Nests are large areas of open ground, typically in parks, where specific Pokemon can be found for a two week period. During this period there\u2026","rel":"","context":"In &quot;Software&quot;","block_context":{"text":"Software","link":"https:\/\/chewett.co.uk\/blog\/category\/software\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/09\/pogo_api_nest_updates-1.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/09\/pogo_api_nest_updates-1.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/09\/pogo_api_nest_updates-1.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/09\/pogo_api_nest_updates-1.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":1020,"url":"https:\/\/chewett.co.uk\/blog\/1020\/pokemon-go-api-list-pokemon-names\/","url_meta":{"origin":2961,"position":1},"title":"Pokemon Go API &#8211; List of Pokemon Names","author":"Chewett","date":"February 17, 2018","format":false,"excerpt":"Here I talk about the first public API for the PoGoAPI.net website and what it does. First Public API and Documentation Today I have launched the first public API for PoGoAPI.net and the associated (short) documentation for it. Earlier I talked about launching the domain and some of the plans\u2026","rel":"","context":"In &quot;Software&quot;","block_context":{"text":"Software","link":"https:\/\/chewett.co.uk\/blog\/category\/software\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/02\/pogo_api_pokemon_names.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/02\/pogo_api_pokemon_names.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/02\/pogo_api_pokemon_names.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/02\/pogo_api_pokemon_names.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":1252,"url":"https:\/\/chewett.co.uk\/blog\/1252\/introducing-the-pokemon-go-api-does-it-nest-page\/","url_meta":{"origin":2961,"position":2},"title":"Introducing the Pokemon Go API &#8220;Does it Nest?&#8221; Page","author":"Chewett","date":"June 13, 2018","format":false,"excerpt":"This blog post talks about the \"Does It Nest?\" page on pogoapi.net and how you can easily find whether something nests without the API. Does it Nest? Previously I have talked about releasing the nesting API for PoGoAPI.net but up until now there has not been an easy way to\u2026","rel":"","context":"In &quot;Software&quot;","block_context":{"text":"Software","link":"https:\/\/chewett.co.uk\/blog\/category\/software\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/06\/pogo_api_does_it_nest.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/06\/pogo_api_does_it_nest.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/06\/pogo_api_does_it_nest.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/06\/pogo_api_does_it_nest.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":2162,"url":"https:\/\/chewett.co.uk\/blog\/2162\/pokemon-go-api-api-hashes-api\/","url_meta":{"origin":2961,"position":3},"title":"Pokemon Go API \u2013 API Hashes API","author":"Chewett","date":"May 1, 2019","format":false,"excerpt":"This post talks about the newest Pokemon Go API, the API Hashes API at pogoapi.net. Using the API Hashes API It is recommended to locally cache the API files so you can store them on your own server and use them as needed. To help facilitate this hash API is\u2026","rel":"","context":"In &quot;Software&quot;","block_context":{"text":"Software","link":"https:\/\/chewett.co.uk\/blog\/category\/software\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2019\/04\/pogo_api_hashes.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2019\/04\/pogo_api_hashes.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2019\/04\/pogo_api_hashes.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2019\/04\/pogo_api_hashes.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":1777,"url":"https:\/\/chewett.co.uk\/blog\/1777\/pokemon-go-api-pokemon-types-api\/","url_meta":{"origin":2961,"position":4},"title":"Pokemon Go API &#8211; Pokemon Types API","author":"Chewett","date":"January 23, 2019","format":false,"excerpt":"This post talks about the newest Pokemon Go API, the Pokemon Types API at\u00a0pogoapi.net. Pokemon Type Data All Pokemon have either one or two types, these types affect the strength of moves and weaknesses it has to opponents moves. Getting the Pokemon Types Data This API lists the types of\u2026","rel":"","context":"In &quot;Software&quot;","block_context":{"text":"Software","link":"https:\/\/chewett.co.uk\/blog\/category\/software\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/11\/pogo_api_pokemon_types-1.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/11\/pogo_api_pokemon_types-1.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/11\/pogo_api_pokemon_types-1.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/11\/pogo_api_pokemon_types-1.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":2199,"url":"https:\/\/chewett.co.uk\/blog\/2199\/pokemon-go-api-pokemon-generations-api\/","url_meta":{"origin":2961,"position":5},"title":"Pokemon Go API \u2013 Pokemon Generations API","author":"Chewett","date":"May 15, 2019","format":false,"excerpt":"This post talks about the newest Pokemon Go API, the Pokemon Generations API at\u00a0pogoapi.net. Using the Pokemon Generations API Each Pokemon has an associated generation that it was originally released in. This generation relates to the generation in the original video games. Currently Niantic are progressing through the generations releasing\u2026","rel":"","context":"In &quot;Software&quot;","block_context":{"text":"Software","link":"https:\/\/chewett.co.uk\/blog\/category\/software\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2019\/05\/pogo_api_generations.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2019\/05\/pogo_api_generations.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2019\/05\/pogo_api_generations.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2019\/05\/pogo_api_generations.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts\/2961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=2961"}],"version-history":[{"count":4,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts\/2961\/revisions"}],"predecessor-version":[{"id":2972,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts\/2961\/revisions\/2972"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/media\/2964"}],"wp:attachment":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=2961"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=2961"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=2961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}