Open hmigneron opened 4 months ago
Any update here i am also facing same issue
Initialising ReportingApi reportingApi = new ReportingApi();
Dependency
<dependency>
<groupId>io.github.jasonchentt</groupId>
<artifactId>tiktok-business-api-sdk-official</artifactId>
<version>1.0.1</version>
</dependency>
Hi @hmigneron, In your case, if you are installing the SDK locally using git clone then use this:
<dependency>
<groupId>io.swagger</groupId>
<artifactId>business_api_client</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
The import in code should be similar to
import io.swagger.client.api.ToolApi;
ToolApi apiInstance;
and inside the class:
apiInstance = new ToolApi();
and you can use apiInstance. toolLanguage to call the api. Hope this helps, moreover I would recommend to use the mvn library tiktok-business-api-sdk-official, and you can follow the example code in the readme.
@hmigneron I think the issue is that, you might not have installed the SDK locally. Please follow the readme file to install it
@rajdeepkhandelwal you can try to initialize in this way, this might solve your issue. first initialize as:
ToolApi apiInstance;
then assign the instance in the class:
apiInstance = new ToolApi();
Since you are using the mvn package:
you can refer to:
import io.swagger.client.api.ToolApi;
import business_api.Response;;
public class ToolTest {
public static void main(String[] args) {
ToolApi apiInstance = new ToolApi();
String accessToken = "Your_accessToken_id";
String advertiserId = "Your_advertiser_id";
try {
Response result = apiInstance.toolLanguage(advertiserId, accessToken);
System.out.println(result);
System.out.println("Success ToolApi#toolLanguage");
} catch (Exception e) {
System.err.println("Exception when calling ToolApi#toolLanguage");
e.printStackTrace();
}
}
}
@saivenkatmandava : That doesn't really answer the more general question though : why is TikTok publishing packages under io.swagger
when clearly they do not own that domain and have no business in that namespace ?
@hmigneron Thanks for noting this issue. We plan to change the groupId in the future major release version. However, we temporarily will keep it to avoid break changes for other sdk users.
The documentation states that maven users should add this dependency to their POM file :
or that gradle users should add the following dependency :
However, this doesn't resolve / the file doesn't exist at this address :
https://repo.maven.apache.org/maven2/io/swagger/business_api_client/1.0.0/business_api_client-1.0.0.pom
More generally, the package name this is documented as using is
io.swagger
, which is not owned by Tiktok (and therefore sounds like a potential trademark issue if swagger were to do anything about it ?)So, which dependency should we add to maven or gradle project to work with this library ?