2

Using the arcgis REST api (http://resources.arcgis.com/en/help/rest/apiref/) using the addFeatures link http://example.com//arcgis/rest/services/name/name/FeatureServer/0/addFeatures how do you add a blob. We've tried the following,

[
{
   "geometry" : {"x" : -118.15, "y" : 33.80},          "attributes" : {
     "name" : "Joe Smith",
     "title" : "Test",
     "descr": "324DFIOWNF83294"
   }
 }
]

does not work (error being Unable to complete operation, "Setting of value for descr failed.") however

[
{
   "geometry" : {"x" : -118.15, "y" : 33.80},          "attributes" : {
     "name" : "Joe Smith",
     "title" : "Test",
     "descr": null
   }
 }
]

edit Base64:

I also tried the following base64 version as Vince suggested

VGhpcyBpcyB0ZXh0IGVuY29kZWQgaW4gYmFzZTY0Lg==

being

This is text encoded in base64.

with the following,

[
{
   "geometry" : {"x" : -118.15, "y" : 33.80},          "attributes" : {
     "name" : "Joe Smith",
     "title" : "Test",
     "descr": "VGhpcyBpcyB0ZXh0IGVuY29kZWQgaW4gYmFzZTY0Lg=="
   }
 }
]

doesn't work.

What encoding does ArcGIS's REST service expect the blob to be in.

The field types are

name - esriFieldTypeString

title - esriFieldTypeString

descr - esriFieldTypeBlob

Specifically descr is,

descr ( type: esriFieldTypeBlob , alias: desc , editable: true , nullable: true )

ArcGIS Server version is 10.3.1

  • You should probably try base64. – Vince Mar 20 '17 at 22:57
  • @vince Tried with the following base 64 VGhpcyBpcyB0ZXh0IGVuY29kZWQgaW4gYmFzZTY0Lg== . Is there some type of content type I have to somehow set? See the edit above for the full submission – Zimm3r Mar 20 '17 at 23:11
  • 1
    You say it "does work", does this mean base64 works? – Kirk Kuykendall Mar 21 '17 at 0:04
  • 1
    You should also query an existing feature, and see how it is returned. – Vince Mar 21 '17 at 0:46
  • @KirkKuykendall doesn't work, sorry about that. – Zimm3r Mar 21 '17 at 3:28
1
+50

The ArcGIS Rest API does not support BLOBs for the JSON feature object. From the documentation:

The values are the field values, and they can be any of the standard JSON types: string, number, and boolean. ArcGIS REST API - Feature Object

Is there a reason you can't use Attachments in your project?

  • Because the data is things we'd want to filter or sort on, for example a text field greater than 255 characters (the limit of the actual text field for Arcgis). For example maybe there is a comment field on a point and to have more than 255 characters you'd have to use a blob but you'd still may want to search against it (which an attachment makes awkward). I did see the note on JSON types, but I'm confused why a blob wouldn't just be a string of some sort (base 64, etc). – Zimm3r Mar 30 '17 at 1:13
0

What we ended up doing is modifying the text length to 1500 instead of 255, this was done through the server database I believe. It was confirmed that for a long time there was a text limit of 255 and I swore I read that somewhere (however can't seem to find it).

I was unable to get the BLOB format working at all, neither through REST API or Javascript. My recommendation is to just increase the text length and use a esriFieldTypeString field. The other option is to use attachments which works for somethings as long as you don't have to search for it.

Summary: Extend the esriFieldTypeString field from a default of 255 to whatever you need. It seems in the past there was a limit of 255 but that is no longer the case it's just the default.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.