Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

Can't create a video with ampersand in title

6 replies [Last post]
Reply

Hello,

I am attempting to create a video using a .NET API call. Here are the querystring items that get sent to the BOTR server at "http : // api.bitsontherun.com / v1 / videos / create" by the .NET API:

title=test %26 2011-04-29 a
description=description
author=mitch mitch
tags=dev
api_format=xml
api_key=YOrdU9ir
api_nonce=76525076
api_timestamp=1304105589
api_signature=72ebe45f2242d79662947ee2e415339ee47fb3f9

What I get back is:

<?xml version="1.0" encoding="UTF-8"?>
<response>
  <status>error</status>
  <_code>SignatureInvalid</_code>
  <title>Signature Invalid</title>
  <message>api_signature: Signature is invalid. Received signature: 72ebe45f2242d79662947ee2e415339ee47fb3f9. Server assembled SBS: api_format=xml&api_key=YOrdU9ir&api_nonce=76525076&api_timestamp=1304105589&author=mitch%20mitch&description=description&tags=dev&title=test%20%26%202011-04-29%20a</message>
</response>

The video is created successfully if the title does not include an ampersand (%26). Can someone tell me what I'm doing wrong?

Thanks,
Mitch

Reply

I'm still struggling with this... Has anyone experienced this? Or - has anyone successfully created a video via the API with an ampersand in the title? I would really like to know if this is an API issue or if I'm just doing something wrong. Thanks.

Reply

The .Net API kit is buggy and this issue is caused by a bug in the .Net API kit implementation.

We have done a review of the API kit recently when looking into some bugs and decided that it was too buggy. Hence we have removed it from our download pages and. Unfortunately it is used too little to warrant the effort of fixing it, so we have decided to discontinue support of the .Net API kit.

Our API itself is open and fully documented, so it is still possible to access it as long as you make valid API calls; call authentication is documented here: http://developer.longtailvideo.com/botr/system-api/authentication.html

The easiest way to get to a API kit that does work correctly would probably be by porting one of the API kits (python and PHP) that is still supported to .Net.

The python API kit is used extensively by our own developers, and the PHP is used extensively by third party developers, so we're quite confident that these two kits are bug-free.

Reply

porting python or PhP API kits in .Net.. how is that done ?? can you please show me snippet..

Reply

We too are facing the same issue. We have started using BOTR and very soon are planning to scale up the usage multi-fold. We need to fix this issue before that.

I can understand your reluctance to fix .Net kit. But since we can't rewrite our .Net application to support your php or python API toolkit, i would appreciate your help in finding a work around through which we can submit unicode & other special characters.

Thanks for your help.

Reply

Here is a .NET function I wrote that encodes properly for me. I call it on each querystring value, and make sure that the encoded value is used both to derive the signature and to send to the API.

using System;
using System.Text.RegularExpressions;

private string EncodeForBOTR(string s)
{
// Replace most reserved characters with their percent encoded equivalents.
string sEncoded = Uri.EscapeDataString(s);

// Replace the reserved characters that EscapeDataString doesn't catch.
sEncoded = sEncoded
.Replace("!", "%21")
.Replace("'", "%27")
.Replace("(", "%28")
.Replace(")", "%29")
.Replace("*", "%2A");

// Make sure the percent encodings are in upper case.
sEncoded = Regex.Replace(sEncoded, "(%[0-9a-f][0-9a-f])", delegate(Match match) {return match.ToString().ToUpper();});

return sEncoded;
}
)

Let me know if you have any questions or if you have found a better way to do this.

Reply

@Mitch: thanks man, it worked like a charm with some modification in my case. But still having curious that at what scenario this will fail ?

Post new comment

  • Allowed HTML tags: <code> <blockquote> <em> <strong> <strike> <ul> <li> <ol>
  • You may post code using <code>...</code> .
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options