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
- Postman Google Chrome Extension
- Dekho 4.1.9 or greater,
- Toggle to Debug log (so we can read a sessionId)
- Sample scripts (see below).
Exercise 1: How to detect what your sessionId is?
- In Dekho Admin, toggle the log to “debug” so we can see the sessionid
- Start your Dekho map with ?debug=y at the end opf the url
- Copy the trace window to clipboard
- Do not close the browser tab running Dekho (!)
- Paste in notepad and look for SessionID
- Start a new Dekho and write down what the sessionId is (see exercise above).
- Use the redline tool to draw some redline (just like a normal client would)
- Start a new Chrome tab and paste the following URL:
Note that you need to substitute your dekho server name (and port), and replace the sessionId with whatever is recorded in step 1.
- 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.
- Go to your Dekho client Tab and clear the redlines – NO NOT REFRESH the browser ; we need to keep our sessionId active.
- Start Chrome Postman ( new tab, click [ ] Apps ; click on Postman)
- In Postman: enter your REST URL
- You will need to look at the Dekho log and extract your SessionID and substitute in URL above. (see previous exercise)
- Toggle to POST
- Click [Hearders]
- Add a header entry called Content-Type application/json
- Select RAW
- Paste the script (see below)
- Click [SEND]
- You should not get any error in the bottom frame
- We have now successfully injected a red line into Dekho, using a JSON script (captured earlier)
- DO NOT REFRESH OR PAN DEKHO YET – We cannot see the result on Dekho because we need to send a final “refresh” command
- Create a new Postman tab and send a refresh command as a GET:
You will need to replace your Dekho host name and your sessionId.