Dev-BLOG: How to inject a redline into Dekho 4.1.9 using REST

Introduction

This blog post is  aimed at developers wishing create a 3rd party tool that programatically injects redlines into a map.  This tutorial contains 3 excercises. The excercises rely on a unique dekho user identification called “session id”.

1. How do I detect your session id?

2. Draw red lines and read the contents as json format

3. Inject a red line into your Dekho client using your sessionId and a redline json drawing

Requirements

Exercise 1: How to detect what your sessionId is?

  1. In Dekho Admin, toggle the log to “debug” so we can see the sessionid
  2. Start your Dekho map with ?debug=y at the end opf the url
    http://leamelhwzltz1:8080/Dekho/?debug=y
  3. Copy the trace window to clipboard
  4. Do not close the browser tab running Dekho (!)
  5. Paste in notepad and look for SessionIDblog1_sessionid
Exercise 2: Draw red lines and read the contents as json format.
  1. Start a new Dekho and write down what the sessionId is (see exercise above).
  2. Use the redline tool to draw some redline (just like a normal client would)
  3. Start a new Chrome tab and paste the following URL:
    http://yourDekhoServer:8080/Dekho/rest/SessionRestService/getRedlineGraphics?sessionId=0A0401E2:014B70F047DA:0625:4B181357
    Note that you need to substitute your dekho server name (and port), and replace the sessionId with whatever is recorded in step 1.
    blog1_saessionid
  4. Copy all the resulting json text and save it in Notepad; We will need this script for the next exercise.

 

Exercise 3: Inject a red line into your Dekho client using your sessionId and a redline json drawing.

  1. Go to your Dekho client Tab and clear the redlines – NO NOT REFRESH the browser ; we need to keep our sessionId active.
  2. Start Chrome Postman ( new tab, click [ ] Apps ; click on Postman)
    blog1_3saessionid
  3. In Postman: enter your REST URL
    http://leamelhwzltz1:8080/Dekho/rest/SessionRestService/drawRedlines?sessionId=0A04015E:014B4C95365B:38BD:5BC9F57B
  4. You will need to look at the Dekho log and extract your SessionID and substitute in URL above. (see previous exercise)
  5. Toggle to POST
    blog1_4saessionid
  6. Click [Hearders]
  7. Add a header entry called Content-Type    application/json blog1_5saessionid
  8. Select RAW
    blog1_6saessionid
  9. Paste the script (see below)
  10. Click [SEND]
  11. You should not get any error in the bottom frame
  12. We have now successfully injected a red line into Dekho, using a JSON script (captured earlier)
  13. DO NOT REFRESH OR PAN DEKHO YET – We cannot see the result on Dekho because we need to send a final “refresh” command

 

  1. Create a new Postman tab and send a refresh command as a GET:
    http://leamelhwzltz1:8080/Dekho/rest/SessionRestService/sendCommandToClient?sessionId=0A0401E2:014B573A28ED:6446:0123ED7D&command=refresh
    You will need to replace your Dekho host name and your sessionId.
    blog1_7saessionid

 

——————–end—————————-

 

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


*