Last active
August 29, 2015 14:04
-
-
Save nixta/3427ba6280b8f531ff43 to your computer and use it in GitHub Desktop.
addFeature() from geoservices-js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Remote Address:70.37.102.106:80 | |
Request URL:http://services.arcgis.com/OfH668nDRN7tbJh0/arcgis/rest/services/Gnip/FeatureServer/0/addFeatures | |
Request Method:POST | |
Status Code:200 OK | |
Request Headersview source | |
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 | |
Accept-Encoding:gzip,deflate,sdch | |
Accept-Language:en-US,en;q=0.8 | |
Cache-Control:max-age=0 | |
Connection:keep-alive | |
Content-Length:3106 | |
Content-Type:application/x-www-form-urlencoded | |
Host:services.arcgis.com | |
Origin:http://services.arcgis.com | |
Referer:http://services.arcgis.com/OfH668nDRN7tbJh0/arcgis/rest/services/Gnip/FeatureServer/0/addFeatures | |
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36 | |
Form Dataview sourceview URL encoded | |
features:[ { geometry: | |
{ x: -11718664.021527646, | |
y: 4868120.824612091, | |
spatialReference: { wkid: 102100 } }, | |
attributes: | |
{ activity_type: 'person', | |
actor_type: 'person', | |
actor_id: 'id:twitter.com:199774657', | |
actor_link: 'http://www.twitter.com/AisforAnne', | |
displayName: 'anne gatchell', | |
actor_postedTime: '2010-10-07T18:07:45.000Z', | |
image: 'https://pbs.twimg.com/profile_images/3686165747/c60b278423510cf47a57c3aec5db1fd7_normal.jpeg', | |
summary: 'Artist -- Software Developer @TwitterBoulder/@Gnip -- Lover of Life', | |
friendsCount: 433, | |
followsCount: 299, | |
listedCount: 16, | |
statusesCount: 2527, | |
timezone: 'Mountain Time (US & Canada)', | |
verified: false, | |
utcOffset: '-21600', | |
username: 'AisforAnne', | |
languages: '', | |
locationType: 'place', | |
location_displayName: 'Boulder, CO', | |
favoritesCount: 1238, | |
verb: 'post', | |
postedTime: '2014-07-29T16:13:39.000Z', | |
generator_displayName: 'TweetDeck', | |
generator_type: '', | |
provider_displayName: 'Twitter', | |
provider_link: 'http://www.twitter.com', | |
link: 'http://twitter.com/AisforAnne/statuses/494153791051034624', | |
body: '@ScottMoorhead @Gnip @TwitterBoulder @ggreenstreet Chamon over and sit with us!', | |
object_type: 'note', | |
object_id: 'object:search.twitter.com,2005:494153791051034624', | |
object_summary: '@ScottMoorhead @Gnip @TwitterBoulder @ggreenstreet Chamon over and sit with us!', | |
object_link: 'http://twitter.com/AisforAnne/statuses/494153791051034624', | |
object_postedTime: '2014-07-29T16:13:39.000Z', | |
twitter_hashtags: '', | |
twitter_symbols: '', | |
twitter_urls: '', | |
twitter_userMentions: '', | |
twitter_filter_level: 'medium', | |
twitter_language: 'en', | |
retweetCount: 0, | |
gnip_urls: '', | |
gnip_expanded_urls: '', | |
gnip_expanded_url_statuses: '', | |
gnip_klout_score: 49, | |
gnip_language: '', | |
gnip_profileObjectType: 'place', | |
gnip_profile_geoType: 'point', | |
gnip_profile_country: 'United States', | |
gnip_profile_countryCode: 'US', | |
gnip_country_DisplayName__: 'Boulder, Colorado, United States' } } ] | |
rollbackOnFailure:false | |
f:pjson | |
token: | |
Response Headersview source | |
Access-Control-Allow-Origin:* | |
Content-Encoding:gzip | |
Content-Length:132 | |
Content-Type:text/plain; charset=utf-8 | |
Date:Wed, 30 Jul 2014 22:30:55 GMT | |
Server:Microsoft-IIS/8.0 | |
X-Powered-By:ASP.NET | |
ConsoleSearchEmulationRendering | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Geoservices = require('geoservices'), | |
client = new Geoservices(); | |
var arcGISRecords = [ { geometry: | |
{ x: -11718664.021527646, | |
y: 4868120.824612091, | |
spatialReference: { wkid: 102100 } }, | |
attributes: | |
{ activity_type: 'person', | |
actor_type: 'person', | |
actor_id: 'id:twitter.com:199774657', | |
actor_link: 'http://www.twitter.com/AisforAnne', | |
displayName: 'anne gatchell', | |
actor_postedTime: '2010-10-07T18:07:45.000Z', | |
image: 'https://pbs.twimg.com/profile_images/3686165747/c60b278423510cf47a57c3aec5db1fd7_normal.jpeg', | |
summary: 'Artist -- Software Developer @TwitterBoulder/@Gnip -- Lover of Life', | |
friendsCount: 433, | |
followsCount: 299, | |
listedCount: 16, | |
statusesCount: 2527, | |
timezone: 'Mountain Time (US & Canada)', | |
verified: false, | |
utcOffset: '-21600', | |
username: 'AisforAnne', | |
languages: '', | |
locationType: 'place', | |
location_displayName: 'Boulder, CO', | |
favoritesCount: 1238, | |
verb: 'post', | |
postedTime: '2014-07-29T16:13:39.000Z', | |
generator_displayName: 'TweetDeck', | |
generator_type: '', | |
provider_displayName: 'Twitter', | |
provider_link: 'http://www.twitter.com', | |
link: 'http://twitter.com/AisforAnne/statuses/494153791051034624', | |
body: '@ScottMoorhead @Gnip @TwitterBoulder @ggreenstreet Chamon over and sit with us!', | |
object_type: 'note', | |
object_id: 'object:search.twitter.com,2005:494153791051034624', | |
object_summary: '@ScottMoorhead @Gnip @TwitterBoulder @ggreenstreet Chamon over and sit with us!', | |
object_link: 'http://twitter.com/AisforAnne/statuses/494153791051034624', | |
object_postedTime: '2014-07-29T16:13:39.000Z', | |
twitter_hashtags: '', | |
twitter_symbols: '', | |
twitter_urls: '', | |
twitter_userMentions: '', | |
twitter_filter_level: 'medium', | |
twitter_language: 'en', | |
retweetCount: 0, | |
gnip_urls: '', | |
gnip_expanded_urls: '', | |
gnip_expanded_url_statuses: '', | |
gnip_klout_score: 49, | |
gnip_language: '', | |
gnip_profileObjectType: 'place', | |
gnip_profile_geoType: 'point', | |
gnip_profile_country: 'United States', | |
gnip_profile_countryCode: 'US', | |
gnip_country_DisplayName__: 'Boulder, Colorado, United States' } } ]; | |
var featureServiceURL = 'http://services.arcgis.com/OfH668nDRN7tbJh0/arcgis/rest/services/Gnip/FeatureServer/0'; | |
var featureService = new client.featureservice({ | |
url: featureServiceURL | |
}, function(err, metadata) { | |
if (err) { | |
console.error('ERROR connecting to Feature Service: ' + err); | |
} else { | |
console.log('Posting Test'); | |
debugger | |
featureService.add({features: arcGISRecords}, function(err, data) { | |
debugger | |
if (err) { | |
console.error(err); | |
} else { | |
console.log('Wrote features OK!'); | |
} | |
}); | |
} | |
}); |
I think I've confused things. That file is the output from the Chrome debugger to show that using the HTML page on the feature service works with the same JSON object being written. There is no token in that request, and the request succeeds. I thought you needed a token too, but that tells me you don't (this service is public).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you have to get a token to manipulate data
https://gist.github.com/nixta/3427ba6280b8f531ff43#file-chrome-log-L75