Select to view content in your preferred language

Offline map area created using REST API will not package

530
2
08-31-2024 06:11 AM
Labels (1)
Gravixx
Emerging Contributor

Hi,

I've been having an issue where when I create an offline area using the REST API, it will not finish packaging, but when I do it manually through the settings of the web map, packaging takes seconds. Here is the api post request:

 

URI uri = new URI("https://packaging.arcgis.com/arcgis/rest/services/OfflinePackaging/GPServer/CreateMapArea/submitJob");
            url = uri.toURL();
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("POST");
            connection.setRequestProperty("content-type", "application/x-www-form-urlencoded");
            connection.setRequestProperty("Host", "www.arcgis.com");
            connection.setDoOutput(true);
            String requestBody =    "f=json" +
                                    "&mapItemId=a29f7bc8938d4a0ab93fe03bc9e194c5" +
                                    "&areaType=ENVELOPE" +
                                    "&area=" +
                                     "{\"" + 
                                        "spatialReference\":{\"latestWkid\":3857,\"wkid\":102100}," +
                                        "\"xmin\" : " + xmin + "," + // Top left point x coordinate
                                        "\"ymin\" : " + ymin + "," + // Bottom right point y coordinate
                                        "\"xmax\" : " + xmax + "," + // Bottom right point x coordinate
                                        "\"ymax\" : " + ymax + // Top left point y coordinate
                                    "}" +
                                    "&token=" + token;

 

 Even when the area is as little as a kilometer squared, it still does not package. Why could this be?

Thanks for reading!

0 Kudos
2 Replies
AnthonyRyanEQL
Frequent Contributor

Are there any differences when you look at the network traffic from your browser using the dev tool for manual creation as compared to your code above?

0 Kudos
Gravixx
Emerging Contributor

Sorry, I've realized that I posted the wrong rest api code yesterday, and i've changed it now. I also looked at the network traffic using the dev tool and I saw no difference in traffic.

0 Kudos