• Resolved alvarocece

    (@alvarocece)


    Greetings,

    I’m trying to use your API REST in my website to add/edit some teams, players and events. I’ve found the API documentation rather lacking in useful information regarding POST operations.

    Im calling the following API call: /wp-json/sportspress/v2/teams using Postman, with POST selected and the following body:

    {
        "title": {
            "rendered": "Equipo Test"
        },
        "content": {
            "rendered": "Equipo Test",
            "protected": false
        },
        "excerpt": {
            "rendered": "Equipo Test",
            "protected": false
        },
        "abbreviation": "ET"
    }

    However, I’m getting this error:

    {
        "code": "empty_content",
        "message": "El contenido, el título y el extracto están vacíos.",
        "data": {
            "status": 400
        }
    }

    I would like to know how my body should be formed or even if it’s possible to create new teams/events though your API.

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Roch

    (@rochesterj)

    Hi there!

    Thanks for reaching out.

    This doesn’t look like a SportsPress issue per se. Check out this link:
    https://stackoverflow.com/questions/46021570/wordpress-rest-api-acting-like-no-data-is-sent

    You can certainly use the API for post actions. But unfortunately, we can’t help you with custom coding via support, this includes the REST API (as it depends on the code you create to interact with it).

    Either way, our devs, and others are free to chime in, but I’m setting this one as resolved as this isn’t a support issue.

    Thanks!

    Thread Starter alvarocece

    (@alvarocece)

    Greetings,

    After checking a few things in that link and other things (like how I was creating my header) I managed to create new players via API.

    Thank you so much.

    Plugin Contributor Savvas

    (@savvasha)

    Hi @alvarocece ,

    I am glad you were able to solve it. Can you please share some steps of your solution for other users with similar issues?

    Thanks in advance,
    Savvas

    Roch

    (@rochesterj)

    That’s awesome! I’m glad it’s resolved!

    Let us know if you need anything else.

    Kind Regards,
    -Roch

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘POST through API’ is closed to new replies.