Archived Forum Post

Index of archived forum posts

Question:

status with photo

Jun 04 '14 at 10:48

I have implemented http://www.example-code.com/vb/http_twitter_oauth.asp and works great. I was trying to modify it to accommodate posting status with an image using https://api.twitter.com/1.1/statuses/update_with_media.json as explained in https://dev.twitter.com/docs/api/1.1/post/statuses/update_with_media

I used req.AddParam "status", "testing" req.AddParam "media[]", "c:img.jpg"

I also changed Set resp = http.PostUrlEncoded("https://api.twitter.com/1.1/statuses/update_with_media.json", req)

It is not working. I get --sendRequestBody statusCode: 403 statusText: Forbidden

Can you provide input or create an example that successfully uploads statuses with a photo?

Thanks


Answer

I forgot to add:

Running on Access 2007 this is the message I get application/octet-stream

ChilkatLog:
  PostUrlEncoded:
    DllDate: May  9 2014
    ChilkatVersion: 9.5.0.39
    UnlockPrefix: Anything for 30-day trial
    Username: EDITOR3:aenrique
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 0
    url: https://api.twitter.com/1.1/statuses/update_with_media.json
    httpRequest:
      httpVersion: 1.1
      verb: GET
      path: /
      contentType: 
      charset: windows-1252
      sendCharset: 0
      mimeHeader: 
      requestParams:
        requestItem:
          name: status
          value: testing
        --requestItem
        requestItem:
          name: media[]
          value: FileName = 'c:\img.jpg'
        --requestItem
      --requestParams
    --httpRequest
    fullRequest:
      a_synchronousRequest:
        generateRequest:
          httpRequestGenStartLine:
            genStartLine:
              startLine: POST /1.1/statuses/update_with_media.json HTTP/1.1
            --genStartLine
          --httpRequestGenStartLine
          addCookies:
            Not auto-adding cookies.
          --addCookies
          addOAuth1Header:
            oauth_timestamp: 1401889763
            oauth_nonce: BDc5nhtrl6zt5MK7yzEU/4tqSFc=
            oauth_consumer_key: cQp2BPoRRUU9192p8bTyi3BXV
            oauth_callback: oob
            oauth_signature_method: HMAC-SHA1
            fullUrl: https://api.twitter.com/1.1/statuses/update_with_media.json
            entityBodyParams:
              paramName: status
              paramName: media[]
            --entityBodyParams
          --addOAuth1Header
          sortedParams:
            oauth_hdr: media%5B%5D
            oauth_hdr: oauth_callback
            oauth_hdr: oauth_consumer_key
            oauth_hdr: oauth_nonce
            oauth_hdr: oauth_signature_method
            oauth_hdr: oauth_timestamp
            oauth_hdr: oauth_token
            oauth_hdr: oauth_version
            oauth_hdr: status
          --sortedParams
          baseStringURI: https://api.twitter.com/1.1/statuses/update_with_media.json
          baseStringURI_encoded: https%3A%2F%2Fapi.twitter.com%2F1.1%2Fstatuses%2Fupdate_with_media.json
          normalizedParams: media%5B%5D=FileName%20%3D%20%27c%3A%5Cimg.jpg%27&oauth_callback=oob&oauth_consumer_key=cQp2BPoRRUU9192p8bTyi3BXV&oauth_nonce=BDc5nhtrl6zt5MK7yzEU%2F4tqSFc%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1401889763&oauth_token=87017768-FCXtOvhbGYRbwiTMeEV30tE4OSqLiFDPP5cvWyDNz&oauth_version=1.0&status=testing
          normalizedParams_encoded: media%255B%255D%3DFileName%2520%253D%2520%2527c%253A%255Cimg.jpg%2527%26oauth_callback%3Doob%26oauth_consumer_key%3DcQp2BPoRRUU9192p8bTyi3BXV%26oauth_nonce%3DBDc5nhtrl6zt5MK7yzEU%252F4tqSFc%253D%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1401889763%26oauth_token%3D87017768-FCXtOvhbGYRbwiTMeEV30tE4OSqLiFDPP5cvWyDNz%26oauth_version%3D1.0%26status%3Dtesting
          signatureBaseString: POST&https%3A%2F%2Fapi.twitter.com%2F1.1%2Fstatuses%2Fupdate_with_media.json&media%255B%255D%3DFileName%2520%253D%2520%2527c%253A%255Cimg.jpg%2527%26oauth_callback%3Doob%26oauth_consumer_key%3DcQp2BPoRRUU9192p8bTyi3BXV%26oauth_nonce%3DBDc5nhtrl6zt5MK7yzEU%252F4tqSFc%253D%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1401889763%26oauth_token%3D87017768-FCXtOvhbGYRbwiTMeEV30tE4OSqLiFDPP5cvWyDNz%26oauth_version%3D1.0%26status%3Dtesting
          oauth_signature: mdNUwMOjrjalK4h73MoV8OvGbhg=
        --generateRequest
      --a_synchronousRequest
      fullHttpRequest:
        domain: api.twitter.com
        port: 443
        ssl: 1
        openHttpConnection:
          Opening connection directly to HTTP server.
          httpHostname: api.twitter.com
          httpPort: 443
          ssl: 1
          connect2:
            connectImplicitSsl:
              checkServerCert:
                Not verifying server certificate...
                Set the RequireSslCertVerify property to true to enable verification.
              --checkServerCert
              Secure Channel Established.
            --connectImplicitSsl
          --connect2
          connectElapsedMs: 172
          HTTP connection succeeded.
        --openHttpConnection
        connectTime: Elapsed time: 172 millisec
        sendRequestHeader:
          sendHeaderElapsedMs: 0
        --sendRequestHeader
        sendRequestBody:
          sendBodyElapsedMs: 0
        --sendRequestBody
        statusCode: 403
        statusText: Forbidden
        readResponseBody:
          contentLength: 71
        --readResponseBody
      --fullHttpRequest
      success: 1
    --fullRequest
  --PostUrlEncoded
  Success.
--ChilkatLog