S
S
Stanislav2015-07-29 15:07:15
Classmates
Stanislav, 2015-07-29 15:07:15

How to properly send mediatopic.post with photo in attachment?

I'm trying to set up sending blog posts with a picture to a group on Odnoklassniki using the api method mediatopic.post . If I send data without photo values ​​in attachment, everything works fine.
I upload the image according to the documentation. I get the upload address through the photosV2.getUploadUrl method with the following parameters:

  • gid - group ID
  • aid - album ID in the group
  • application_key - application key
  • count - 1

I send the file to the received address. The image is loaded successfully, I get tokens and photo_id. Next, I complete the download using the photosV2.commit method , which returns SUCCESS in the response.
The image appears in the album.
Next, I specify the token of the uploaded image in the attachment field: "media": [
{
"type": "photo",
"list": [
{ "id": "photoToken" }
]
} I execute
api mediatopic.post and get the following response:
" {"error_code":100,"error_msg":"PARAM : Photos should not belong to the album.","error_data":null}"
If you do not specify aid when getting the upload address, the result will also be an error with the text "The photo must belong to the album."
Tell me, where did you make a mistake?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan, 2015-07-31
@stascer

https://apiok.ru/wiki/display/api/photosV2.commit+ru
It turns out that after photosV2.getUploadUrl you need to immediately do mediatopic.post .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question