POST using Python failing

I’m trying to upload using python requests through a custom app.

My post request looks something like this -
requests.post(https://api.sketchfab.com/v3/Models, data={‘name’: ‘ASSET NAME’, ‘description’: ‘ASSET DESCRIPTION’, ‘tags’: ‘TAGS’, ‘private’: True, ‘isInspectable’: False, ‘isPublished’: True}, files={‘modelFile’: <_io.BufferedReader name=‘ZIP PATH’>}, headers={‘Authorization’: ‘Token ################################’})

It was working fine until a few weeks ago, now my post requests return “<Response [200]>” with json data that looks like a basic search response…
“{‘cursors’: {‘next’: ‘bz0yNA==’, ‘previous’: None}, ‘next’: ‘https://api.sketchfab.com/v3/models?cursor=bz0yNA%3D%3D’, ‘previous’: None, ‘results’: […”

Any help would be very much appreciated.

1 Like

Hello Poliigon,

I looked at the POST you made today on /v3/models, but I do not see the search response you described.
This is an example of response I found in the logs for one of your request:

"response": {
    "code": 201,
    "body": {
        "uid": "b13bfxxxxxxxxxxxxxxxxxxxxxacc151",
        "uri": "https://api.sketchfab.com/v3/models/b13bfxxxxxxxxxxxxxxxxxxxxxacc151"
    }
}

Could you give more details about the request that caused this response so I can find out what is happening?

1 Like

Hi Quentin,

Thanks for your response.

I’ll message you directly so I can share sensitive info.

Phil

Hello Phil,

You are making a POST on /v3/Models instead of /v3/models. This is causing a redirection (HTTP 301) to a GET on /v3/models and this is why you are seeing this response.

This is your request and the response:

"payload": {
    "headers": {...},
    "method": "POST",
    "uri": "/v3/Models",
    "body": {
        "POST": {
            "private": "True",
            "isInspectable": "False",
            "isPublished": "True",
            "name": "Hdr Interior Greenwich Foot Tunnel 001",
            "description": "HDRIs from https://www.poliigon.com",
            "tags": "poliigon hdr preview"
        }
    }
},
"response": {
    "code": 301,
    "body": ""
}

Similarly,
/v3/me/search?type=Models&sort_by=-createdAt
should be
/v3/me/search?type=models&sort_by=-createdAt

I will have a look at why this is not behaving like it used to be, thank you for letting us know about it!

Please let me know if it fixed things for you.

Thanks,
Quentin

2 Likes

Hi Quentin,

Thanks for your help - I just fixed the URLs and it’s back to working as usual! =D

Cheers,
Phil

2 Likes