Call Twitter Endpoint API to follow another user Android -


i'm using twitter end point api follow user. api is:

https://api.twitter.com/1.1/friendships/create.json?follow=&screen_name=&user_id=

with authorization header passed as:

@headers("authorization: oauth oauth_consumer_key=dc0sepobbq8bydc8smg,oauth_signature_method=hmac-sha1,oauth_timestamp=1502774524,oauth_nonce=175308858,oauth_version=1.0,oauth_token=712057165-iqb4b4q0hsnmhsaxiw4x5uf5xvb6jmkophxnw,oauth_signature=x0gexh5dbvgvv49jko3lwfx8%3d") @post() @formurlencoded call<responsebody> followuser(@url string url, @field("follow") boolean follow, @field("screen_name") string screenname, @field("user_id") string userid); 

in retrofit api call android. works fine. auth header has generated dynamically every logged in user. how achieve that?

you can use @header annotation in parameter list. please check official documentation.

replaces header value of target.

 @get("/")    call<responsebody> foo(@header("accept-language") string lang); 

header parameters may null omit them request. passing list or array result in header each non-null item.

note: headers not overwrite each other. headers same name included in request.


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -