URIBuilder / Rest / LinkedIn [英] URIBuilder / Rest / LinkedIn

查看:55
本文介绍了URIBuilder / Rest / LinkedIn的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

.Net 3.5中的问题格式化链接的rest api的URL。其余的url有一个编码的url作为请求的一部分 - 不是作为查询字符串参数如下。 .Net URI构建器似乎没有一种处理这些URL的机制,而我正在寻找一种方法来获取我需要的数据。

Have an issue in .Net 3.5 formatting a URL for a rest api on Linked in. The rest url has an encoded url as part of the request - not as a querystring parameter as below. The .Net URI builder doesnt seem to have a mechanism for processing these urls and I am looking for a work around to get the data where i need to be.

我们想要获得的输出是我们发布的Rest URL,然后是我们所追求的信息的URL。喜欢这个

The output we are trying to get to is the Rest URL we are posting to and then the URL for the information we are after. Like this

http://api.linkedin.com/v1/people/url=http%3a%2f%2fuk.linkedin.com%2fpub%2fjulian-welby-everard%2f0 %2fb97%2f416

http://api.linkedin.com/v1/people/url=http%3a%2f%2fuk.linkedin.com%2fpub%2fjulian-welby-everard%2f0%2fb97%2f416

尝试了不同程度的过度编码(根据下面的示例),但.Net正在解码到远处,我们最终得到的URL不能与linkedin的rest接口一起使用。

Have tried various degrees of over encoding (per the example below) but .Net is decoding to far and we end up with a URL that wont work with linkedin's rest interface.

代码片段是问题的控制台示例 我试图在没有任何api或http位的情况下克服..已经玩过字符集无法获得;问题是基本网址没有问号,所以我们不能使用系统上的URI

The code snippet is a console example of the issue I am trying to overcome without any of the api or http bits.. Have played with character sets to no availl; the issue is that the base url has no question mark so we can't use the options on the URI

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
 
namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            string URL =
                "http://api.linkedin.com/v1/people/url=http%3a%2f%2fuk.linkedin.com%2fpub%2fjulian-welby-everard%2f0%2fb97%2f416";
 
            Console.WriteLine("Before: " + URL);
            UriBuilder uri = new UriBuilder(URL);
            Console.WriteLine("After:  " + uri.Uri.ToString() );
 
            URL =
                "http://api.linkedin.com/v1/people/url=http%253a%252f%252fuk.linkedin.com%252fpub%252fjulian-welby-everard%252f0%252fb97%252f416";
            Console.WriteLine("Before: " + URL);
            uri = new UriBuilder(URL);
            Console.WriteLine("After:  " + uri.Uri.ToString());
 
        }
    }
}

推荐答案

   这是一个Visual Basic论坛。祝你好运。
    This is a Visual Basic Forum. Good luck.


这篇关于URIBuilder / Rest / LinkedIn的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆