Hi,
I have been trying to export a container from 1 instance and import it to another using APIs in a script, but when I try to add the exported JSON as the arguement for import API, I get a 414, anyone else facing the same? Or can point out what I am doing wrong here:
print(container)
params={ ‘exportedContainerVersion’:6,‘idSite’:siteid, ‘idContainer’:‘ID’,‘token_auth’:token_auth}
updcontainer= “https://”+url+“/?module=API&method=TagManager.importContainerVersion”
print(requests.Request(‘POST’,updcontainer,params=params).prepare().url)
print(requests.post(updcontainer,params=params,verify=False,json=container))
Hi @vverma21
HPPT 414: URI too long…
What is your version of Matomo?
Do you use directly the API, or do you try to import the container through the Matomo user interface? If you use the API, I suggest you post the JSON in the payload instead of in the URI.
Hi @heurteph-ei , the version is 5.1.2 and can you send me an example with the JSON in the payload? I get a 200 response but i can see it imported
Hi @vverma21
I dont know how (with which technology) you send the request?
I am using python to write a script for this, as shown in the post, using the requests package
Hi @vverma21
I would suggest you have a look at:
I know how it works, I need an example in the context of matomo import container call. Considering we arent giving anything in the exportcontainerversion parameter where a json object is expected as using this way doesnt work. I get a 200 response but nothing is imported on matomo side
Did you try the same JSON via the Matomo UI?
Maybe an error message can be displayed?
yes i tried, no error its getting imported.
@heurteph-ei anything?
Hi @vverma21
I suggest you spy the request the UI sends to the server…