上传至vimeo后设置视频元数据



我已经使用API V3成功上传视频到vimeo。现在,我想设置一些元数据,如姓名,描述,隐私。查看上传的视频。

当我尝试使用vimeo playground时,它获得成功:https://developer.vimeo.com/api/endpoints/videos#/{video_id}

但在代码中,我尝试了以下两种方法,但都没有成功。

NSString *strURL = [NSString stringWithFormat:@"%@videos/%@?access_token=%@&name=%@&description=%@&privacy.view=%@", VIMEO_API_CALL_URL, strVideoID, VIMEO_ACCESS_TOKEN_TEMP, strName, strDescription, strPrivacyView];
NSURL *URL = [NSURL URLWithString:[strURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:URL];
[request setHTTPMethod:@"PATCH"];

和后面的also

NSString *strURL = [NSString stringWithFormat:@"%@videos/%@?access_token=%@", VIMEO_API_CALL_URL, strVideoID, VIMEO_ACCESS_TOKEN_TEMP];
NSURL *URL = [NSURL URLWithString:[strURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:URL];
[request setHTTPMethod:@"PATCH"];
[request setValue:@"iOS_QuickTime" forHTTPHeaderField:@"name"];
[request setValue:@"This video is uploaded via iOS applcation and to perform last step by adding all required metadata." forHTTPHeaderField:@"description"];
[request setValue:@"nobody" forHTTPHeaderField:@"privacy.view"];

, VIMEO_API_CALL_URL"https://api.vimeo.com/";

我在寻找答案。

您的访问令牌应该包含在适当的身份验证头中。像这样:

Authorization: Bearer xxxxxxxxxtokenxxxxxxx

你试图设置的值(标题,描述,隐私)应该是查询参数,而不是头键/值。所以你的第一个方法是正确的。

你也可以考虑使用Vimeo iOS SDK(我是作者之一)或只是浏览代码库来帮助你从A点到B点:

https://github.com/vimeo/VIMNetworking

您也可以在该回购中提交问题。

最新更新