پشتیبانی پایگاه داده‌ فیلم

I have problems to set rating for a movie using .net webclient. I also tried it with .net webrequest. But i didnt get it to work. Hope anyone can help me.

Private Function getGuestSessionId() As String
          
            dim api As String = "xxx"

            Dim WebClient As New WebClient
            WebClient.Headers.Add("Accept", "application/json")
            Dim _json As String = WebClient.DownloadString("http://api.themoviedb.org/3/authentication/guest_session/new?api_key=" & api)
            WebClient.Dispose()

            Dim arrList As New ArrayList(_json.Split(","c))

            Return Replace(Regex.Replace(arrList(1), "[{:}" & Chr(34) & "]", String.Empty), "guest_session_id", String.Empty)

        End Function

getting the guest_session_id works perfect.

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
            Try
                Dim api As String = "xxx"

                Dim client As New Net.WebClient
                client.Headers.Add("Content-Type", "application/json")
                client.Headers.Add("Accept", "application/json")
                Dim responsebytes = client.UploadData("http://themoviedb.apiary.io/3/movie/119680/rating?api_key=" & api & "&guest_session_id=" & getGuestSessionId(), _
                                    "POST", System.Text.Encoding.UTF8.GetBytes("{" & vbLf & "    ""value"": 7.5" & vbLf & "}"))

            Catch webex As WebException
                MsgBox(webex.Message)
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try

        End Sub

4 پاسخ (در صفحه 1 از 1)

Jump to last post

I can't help with anything VB specific but I can't help but notice the UploadData call is using the testing platform, Apiary. What happens when you use the real production end point? Do you get an error?

What do you mean with "use the real production end point". C# examples will also help :)

Your guest session request is using api.themoviedb.org while the rating call is using themoviedb.apiary.io. Apiary is meant only for testing and most of the time, you'll want to test requests with the real world production environment, api.themoviedb.org. This is especially true for any POST methods like rating.

thx Travis Bell for the hint, now it waorks as it should ;)

فیلم و نمایش تلویزیونی را نمی‌توانید پیدا کنید؟ به سیستم وارد شوید تا آن را ایجاد کنید.

Global

s تمرکز بر منوی جستجو
p منوی پروفایل باز شود
esc بستن پنجره باز
? پنجره میانبرهای صفحه‌کلید باز شود

در صفحات مدیا

b بازگشت به عقب (یا در صورت لزوم به منشا)
e برو به صفحه ویرایش

در صفحات فصل تلویزیونی

(فلش سمت راست) برو به فصل بعد
(پیکان سمت چپ) برو به نشست قبلی

در صفحات قسمت تلویزیونی

(فلش سمت راست) برو به قسمت بعد
(پیکان سمت چپ) برو به قسمت قبلی

در تمام صفحات تصویر

a پنجره افزودن تصویر باز شود

در تمام صفحات ویرایش

t انتخابگر ترجمه باز شود
ctrl+ s ثبت از

در صفحات بحث

n ایجاد بحث جدید
w تغییر وضعیت وضعیت تماشا
p تغییر وضعیت عمومی/خصوصی
c تغییر وضعیت بسته/باز
a گشایش صفحه فعالیت
r پاسخ به بحث
l برو به آخرین پاسخ
ctrl+ enter پیام خود را ثبت کنید
(فلش سمت راست) صفحه بعد
(پیکان سمت چپ) صفحه قبلی

تنظیمات

آیا می‌خواهید به این مورد امتیاز دهید یا به فهرست اضافه کنید؟

ورود