Tyk-sync example

Hello,

I’m struggling to use tyk-sync with gitlab, I find the documentation to be kinda short on this.
Since I don’t use a dashboard, I can’t start by a tyk-sync dump and thus I don’t really know what my tyk-sync repository is supposed to look like.

I was under the assumption that the only thing to do was having my api/policies definition in a file named .tyk.json in my gitlab repository. And that a sync command would upload them in my tyk install.
But I get an error saying “Type must be 'apidef or ‘oas’”. My file format is probably wrong, but I don’t what it is supposed to look like. Can anyone provide me with an example ?

Thanks in advance

here is what my json file looks like :

“api_definition”: {
“name”: “myApiName”,
“slug”: “A Super Api”,
“api_id”: “api01”,
“org_id”: “myOrg”,
“auth”: {
“auth_header_name”: “Authorization”
},
“version_data”: {
“not_versioned”: true,
“versions”: {
“Default”: {
“name”: “Default”,
“use_extended_paths”: true
}
}
},
“enable_ip_whitelisting”: false,
“enable_ip_blacklisting”: true,
“enable_batch_request_support”: true,
“proxy”: {
“listen_path”: “/path/”,
“target_url”: “https://my.rest.server.org”,
“preserve_host_header”: true,
“strip_listen_path”: false
},
“active”: true
}
}

Hi Thierry,
did you see https://tyk.io/docs/manage-multiple-environments/tyk-sync/ ?
Maybe you missed this documentation?
Have a successful day!
/mike

Hi,

I did see this page, but I’m still stumped as to what my .tyk.json is supposed to look like.
Maybe it is self evident, but I can’t wrap my head around it :confused:

Have a great day too :slight_smile:

This problem still exists. I’ve found advice to structure my .tyk.json like this:

{
    "type": "oas",   
    "files": [
        {
            "file": "./my-oas-api-definition.json",
            "oas": {
                "version_name": "v1" 
            }
        }
    ]
}

However, where is the API definition for this file? I don’t have any idea what my options here are.

xpost of the issue I created on the tyk-sync repo: Documents need improvement · Issue #116 · TykTechnologies/tyk-sync · GitHub

@skawaguchi_flipp I may have answered your question here Tyk-sync installation and publishing - #5 by Olu

I have one more question here 1) I have tyk gateway self hosted on aws k8s and and lb infront

  1. I have private gitlab contains .json api defination files normal one

  2. I am trying to use tyk sync with -g gateway lb url and -b my private gitlab I am getting authentication error how to pass access token -k is failing with file not found error

@Olu please help here how to solve this?

I am not sure this would work. You would need to query each gateway individually.

I haven’t tried to use the -k param before but a quick look at the source code of sync shows it might require an SSH key