Select to view content in your preferred language

Acquire locks LRS REST API query unclear documentation issues and query doesn't work as expected

566
4
Jump to solution
11-06-2024 08:56 AM
Sergio
by
Emerging Contributor

Hi,

I was trying to test the following query described in this documentation - https://developers.arcgis.com/rest/services-reference/enterprise/lr-acquire-locks/.

/MapServer/exts/LRServer/locks/acquire

The problems I've faces is:

First of all it seems that this query is a POST query rather than GET as pointed in the header of the link.

Second, acquireLocks parameter is pointed as "Optional", which in fact is wrong and when I remove it it returns following response:

{"error":{"code":400,"message":"'acquireLocks' parameter not specified.","details":[]}}

When I pass it as follows:

[{"routeId": "{myRouteUniqueID}", "layerId": 1}]

I get following response:

{"error":{"code":400,"message":"'lineId' parameter not specified.","details":[]}}

When I pass following acquireLocks parameter:

[{"routeId": "{myRouteUniqueID}", "layerId": 1}, {"lineId": "{myCenterlineUniqueId}", "layerId": 2}]

I STILL get following response:

{"error":{"code":400,"message":"'lineId' parameter not specified.","details":[]}}

My ultimate goal is to load calibration points through applyEdits query (https://developers.arcgis.com/rest/services-reference/enterprise/apply-edits/)

To do this I should get exclusive locks on the routes I want to add calibration points to. My questions are - what should I pass as "routeId","lineId" and "layerId" and how should I do this? in the documentation it is pointed that JSON should be like this:

[ { "routeId": "<routeId>", "layerId": <layerId> } | { "lineId": "<lineId>", "layerId": <layerId> }, ... ]

Which is nonsense as "|" doesn'rt work in JSON. And returns error.

So, I put my routeId as routeId, my CenterlineID as lineID and layerId my centerlines and routes published layers Ids.

Can anyone show the working example of JSON I should pass as acquireLocks parameter in /MapServer/exts/LRServer/locks/acquire query which create locks on multiple routes to allow to further load calibration points for these routes?

Thank you in advance!

0 Kudos
1 Solution

Accepted Solutions
AyanPalit
Esri Regular Contributor

Here are some samples from my sandbox environment intended to demonstrate the REST API calls. User specific LRS model, LRS attributes need to be factored in and modify parameters to make it work.

  • Query locks: Home > services > Pipeline (MapServer) > LRServer > locks > query  - where 1=1  The response gives you the format sample

    AyanPalit_0-1730991730401.png

  • Acquire locks: Home > services > Pipeline (MapServer) > LRServer > locks > acquire  - ADMIN.Ayan_APR | [{"lineId":"{06207673-6B1F-45A7-98FA-264AD4489804}","layerId" : 911},{"lineId":"{0E025F44-A0B5-435D-9827-AD1A871C8940}","layerId" : 911}]

First attempt executed but no locks acquire as reconcile was needed.

      AyanPalit_1-1730991761951.png

  • Acquire locks: Home > services > Pipeline (MapServer) > LRServer > locks > acquire  - ADMIN.Ayan_APR | [{"lineId":"{06207673-6B1F-45A7-98FA-264AD4489804}","layerId" : 911},{"lineId":"{0E025F44-A0B5-435D-9827-AD1A871C8940}","layerId" : 911}]

Reconciled versions and acquired locks

    AyanPalit_2-1730991779678.png

 

  • Release locks: Home > services > Pipeline (MapServer) > LRServer > locks > release  - [{"lineId":"{06207673-6B1F-45A7-98FA-264AD4489804}","layerId" : 911},{"lineId":"{0E025F44-A0B5-435D-9827-AD1A871C8940}","layerId" : 911}]

   

AyanPalit_3-1730991779680.png

Ayan Palit | Principal Consultant Esri

View solution in original post

4 Replies
AyanPalit
Esri Regular Contributor

@Sergio have you tried the format below (one of the samples in the Acquire Locks documentation):

https://sampleserver/arcgis/rest/services/MyLRS/MapServer/exts/LRServer/locks/acquire?f=json&editVer...[{"routeId":"I90","layerId":3},{"lineId":"NWS Line A","layerId":4}] 

Ayan Palit | Principal Consultant Esri
0 Kudos
Sergio
by
Emerging Contributor

Hi @AyanPalit , Yes I did. The problem is that it is unclear what is the routeId and lineId in terms of APR and LRS? routeID is the OBJECTID (seems like that according to your example)?

Whatever I put into lineId parameter, I get:

{"error":{"code":400,"message":"'lineId' parameter not specified.","details":[]}}

0 Kudos
Sergio
by
Emerging Contributor

Couple more additions to what I've discovered. The final goal is to create calibration points using applyEdits query (that's why I'm trying to acquire locks), so when it comes to this query it returns following response:

{
    "error": {
        "code": 400,
        "message": "LRS locks must be acquired for lines, routes or events before editing.",
        "details": []
    },
    "missingLocks": [
        {
            "lineId": "{PARENT_NETWORK_ROUTE_ID}",
            "layerId": my network layer Id
        }
    ]
}
 
When I put actual "{PARENT_NETWORK_ROUTE_ID}" to the acquireLocks query like this:
 
[{"lineId": "{PARENT_NETWORK_ROUTE_ID}", "layerId": my network layer Id}]
 
I get following error in response:
 
{"error":{"code":400,"message":"There was a problem while acquiring locks.","details":[]}}
 
Is there any clear explanation how this endpoint should work with clear and working examples?
Documentation doesn't provide any.
0 Kudos
AyanPalit
Esri Regular Contributor

Here are some samples from my sandbox environment intended to demonstrate the REST API calls. User specific LRS model, LRS attributes need to be factored in and modify parameters to make it work.

  • Query locks: Home > services > Pipeline (MapServer) > LRServer > locks > query  - where 1=1  The response gives you the format sample

    AyanPalit_0-1730991730401.png

  • Acquire locks: Home > services > Pipeline (MapServer) > LRServer > locks > acquire  - ADMIN.Ayan_APR | [{"lineId":"{06207673-6B1F-45A7-98FA-264AD4489804}","layerId" : 911},{"lineId":"{0E025F44-A0B5-435D-9827-AD1A871C8940}","layerId" : 911}]

First attempt executed but no locks acquire as reconcile was needed.

      AyanPalit_1-1730991761951.png

  • Acquire locks: Home > services > Pipeline (MapServer) > LRServer > locks > acquire  - ADMIN.Ayan_APR | [{"lineId":"{06207673-6B1F-45A7-98FA-264AD4489804}","layerId" : 911},{"lineId":"{0E025F44-A0B5-435D-9827-AD1A871C8940}","layerId" : 911}]

Reconciled versions and acquired locks

    AyanPalit_2-1730991779678.png

 

  • Release locks: Home > services > Pipeline (MapServer) > LRServer > locks > release  - [{"lineId":"{06207673-6B1F-45A7-98FA-264AD4489804}","layerId" : 911},{"lineId":"{0E025F44-A0B5-435D-9827-AD1A871C8940}","layerId" : 911}]

   

AyanPalit_3-1730991779680.png

Ayan Palit | Principal Consultant Esri