How are you compressing your URIs or query string for HTTP GET methods?
We are looking for some feedback about how we can compress/decompress query string parameters in HTTP GET methods. For some applications, we have very large URIs, and we don't want to move to the POST Method. Are there any doing this in TR, to share how this was done ?
Tagged:
1
Answers
-
I've done a few things to try to compress URIs to keep them under the ~2000 character limit.
The first (and most obvious) is to use short names for query string parameters. Instead of full words for parameter names, go down into single character names. Obviously this hurts the readability of your code and URIs.
The second is to use integer values or shorted values for things that are essentially enums. E.g. if you had a parameter that accepted the possible countries as values, establish a mapping as part of your contract that 1=Canada, 2=Mexico, etc. Again, readability suffers here.
The final approach that can be done is aggregating data into opaque fields that can be compressed in some way. An example of this would be to combine multiple parameters into a single value, compress it, and pass it as single Base64 encoded parameter. Again, readability really suffers, and you have have to be careful that the final parameter will actually be smaller than the data you started with.
Most of these techniques I haven't done on Thomson Reuters applications, but rather my own projects.3 -
Thanks for your answer Ryan.0
-
Another approach may be to adopt a POST/GET model if you need to pass a lot of information. You could POST a request to "create" a resource which would return a resource handle of some kind. This is then followed up with a GET for that created resource. This adds some complexity however. You will either need server affinity (ie POST and GET to the same server) or you will need a shared resource to store the results that all your severs can read from. Some examples are a NAS filesystem, a database, or a shared cache like coherence. Another thing to keep in mind is that we need to be pragmatic when using REST. Even though the semantics of a POST may not match what your endpoint is accomplishing, it may make sense to use a POST anyway to avoid additional complexity and overhead. This struggle with the GET URL limit comes up all the time and has no easy answers.1
-
The only other thing I would add to Ryan's answer is that if you have several enumerated value (or a finite set of expected values) fields, then you could come up with shorthands for all of the possible combinations, e.g. `?cty=mx&lang=es` might become `?loc=mx-es`, or `opt1=value1&opt2=value2&opt3=value3` might become `?opts=knownCombo1`. Again, readability suffers.0
Categories
- All Categories
- 6 AHS
- 38 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛