F
F
fursaar2022-04-10 16:55:26
css
fursaar, 2022-04-10 16:55:26

Why can't write VK API request?

Unable to send VK API request. Error : {"error":{"error_code":5,"error_msg":"User authorization failed: no access_token passed.","request_params":[{"key":"method","value":"wall. post"},{"key":"oauth","value":"1"}]}}

private static final String url = "https://api.vk.com/method/";
    private static final String token = "Мой токен";
    private static final String version = "5.131";

    public static String wallPost(String message) {
        String url = String.format("https://api.vk.com/method/");
        String request = String.format("wall.post?message=%s&access_token=%s&v=%s", message, token, version);
        return given()
                .baseUri(url)
                .basePath(request)
                .when().post()
                .then()
                .extract().asString();
    }

The token is exactly correct, I received it through the Standalone application, for some reason the parameters (message, api version) are not specified in the error, so it seems to me that the problem is specifically in my Api request, but for some reason I don’t see it

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander, 2016-09-08
@dev400

Like this, for example:

<div class="b-blocks">
    <div class="b-blocks__item">
        <div class="b-blocks__item-inner"></div>
    </div>
    <div class="b-blocks__item">
        <div class="b-blocks__item-inner"></div>
    </div>
    <div class="b-blocks__item">
        <div class="b-blocks__item-inner"></div>
    </div>
    <div class="b-blocks__item">
        <div class="b-blocks__item-inner"></div>
    </div>
</div>

.b-blocks {
    background: #fff;
    padding: 20px;
    width: 800px;
    
    &::after {
        content: '';
        display: table;
        clear: both;
    }
    
    &__item {
        float: left;
        box-sizing: border-box;
        width: 48%;
        height: 300px;
        padding: 10px;
        margin: 1%;
        background-color: gray;
        background-image: repeating-linear-gradient(45deg, transparent, transparent 35px, rgba(255,255,255,.5) 35px, rgba(255,255,255,.5) 70px);
        
        &-inner {
            width: 100%;
            height: 100%;
            background: #fff;
            
        }
    }
}

https://jsfiddle.net/hyjra7j8/6/

D
defriz, 2022-04-10
@fursaar

https://vkhost.github.io/ , Kate Mobile method

S
Samuel_Leonardo, 2022-04-10
@Samuel_Leonardo

separately add parameters via .queryParam
.basePath most likely just discards them

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question