I need use the ArcGIS REST API to query my ArcGIS Server services, the where parameter is like ObjectID in (1, 2, 3,...,2000). When the number of object ids is larger than 1000, the returned result shows "Unable to complete operation".

  • This is a hideously expensive query mechanism. The "Doctor's Advice" applies to this situation ("Doctor, doctor! It hurts when I do this" "Don't do that.") There's also a limit on the number of features returned because that, too, is inefficient (large and slow). Rather than ask how to go against best practice, you really ought to be asking about the problem to which this use pattern is your solution (aka XY Problem ) – Vince Jan 4 '18 at 12:52

Depending on the type of database, there may be a limit on the amount of items that can be inside the IN clause. I think Oracle has a limit of 1000.

Two things you could try are:

  • Instead of using where, use objectids=1,2,3, ... in the REST call
  • Split the list of objectids in groups of 1000: where=objectid in (1,2, ... ,1000) OR objectid in (1001,1002, ... ,2000)


The above solution will fix the error message, but you'll still hit the 1000 feature limit imposed by ArcGIS Server. 1000 features is the default in current versions, in older version it used to be 500. To get more than 1000 features, you need to change a setting in ArcGIS Server, or do multiple requests in batches of 1000.

You should also ask yourself if you really need to get all features. There are valid use-cases to do so, but it would help if you tell us why you think you need to.

  • 1
    I see this answer is accepted but it just seems not true what-so-ever. I don't really want to downvote it as its good try, just not correct. The 1000 record limit is an generic default applied to all ArcGIS Server services. It has nothing to do with IN clauses or Oracle or anything database. Its just the default that services are born with. Publishers can change this to be what they like - I often bump mine to 10,000. Note there are solid reasons for publishers to limit their maximum record counts as memory is always dear and converting features to JSON is expensive. – pauldzy Jan 5 '18 at 15:45
  • 1
    @pauldzy There is indeed also the AGS 1000 feature limit, but that wouldn't case the error message. It will just give you 1000 features. This generic error is in most cases caused by the underlying database. I will update my answer shortly. – Berend Jan 8 '18 at 8:42
  • Hmm, alrighty I concede your point. Apologies for the aspersions. It just seemed wrong that AGS is passing the where clause as a literal to the backend but perhaps it does or perhaps it depends on the backend being used. I'll try this with a fgdb backend and see what happens. – pauldzy Jan 9 '18 at 13:07

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.