Hello all, I have an API request related challenge...
# troubleshooting
f
Hello all, I have an API request related challenge that I hope to get help on from this forum. I am using the tap plugin tap-rest-api-msdk. A requirement is that in a header, there is a dictionary for Conversation_id, currently set to a hard-coded value. However I need to generate unique IDs for this and for every request that is being sent. This would form part of the header config. Config section in yml would look like below just for context. - name: tap-my-inherited-tap inherit_from: tap-rest-api-msdk config: auth_method: oauth grant_type: client_credentials headers: '{"ConversationID": "62da4108-67a1-4c0a-b20c-8e454420798e",..............} What would be the best way to generate unique IDs for this conversation ID and define as a variable? Something along the lines of being able to generate uuid from python uuid and assign it to each call in the header. Im new to this whole thing, python, meltano, api et all, so please respond keeping that in mind, much appreciated.
Copy code
import uuid
unique_id = uuid.uuid4()
I figured that if I could simply use the run_id generated for each run and pass it as a variable, then I can achieve what I want. So the question perhaps is, is there a way to get the run_id as a variable?
e
@Fayaz Ahmed
I need to generate unique IDs for this and for every request that is being sent
Do you need a unique ID for each HTTP request?
f
Thanks @Edgar Ramírez (Arch.dev) for responding back. Ideally yes, but if this is not possible, then atleast per meltano run/el I would like to get a unique ID. If the former is complicated, then the latter will do, but would like to understand what might be involved if a UID is required for each HTTP request as well at least high level conceptually.
s
Hi Fayaz, I believe the requirement is for each ETL run rather than individual requests.
👍 1
e
If that is so, I'd look into how the tap accepts custom headers via configuration and maybe generate UUID with something like the
uuid
command line tool
👍 1
(or create a custom tap, that's always an option if tap-rest-api-msdk doesn't fit your use case)
👍 1
f
Thanks @steve_clarke (and hello Steve, good to see you here) and @Edgar Ramírez (Arch.dev) for your guidance. Appreciate it.
👍 1
np 1