Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Wanted type [Integer] but got '5'" Error when trying to run "POST" API #3072

Open
kittkod opened this issue Nov 5, 2023 · 0 comments
Open

Comments

@kittkod
Copy link

kittkod commented Nov 5, 2023

Hi, I'm new at all of this so excuse me if this is a dumb mistake or if this is the wrong place to ask this. If theres somewhere better to ask this as well, please let me know.
I'm trying to update the locations of barcodes using this method in archivesspace :

https://archivesspace.github.io/archivesspace/api/?python#update-location-for-a-batch-of-top-containers

Just to test it out, I've just been running my code with the example:

client.post('repositories/2/top_containers/batch/location',
params={ 'ids': [1,2,3,4,5],
'location_uri': 'locations/1234' })

but I am using python, so it looks like:
response = requests.request("POST", url, params={'ids':[1,2,3,4,5], 'location_uri':'ABClocation1'}, headers=headers)

but it is not behaving correctly. If anyone could give some advice that would be awesome.

Expected Behavior

what should happen (hopefully), is that I'm able to attatch a barcode (from 'ids') to a location ('location_uri').

Current Behavior

currently, when I run my code with
print(response)
print(json.loads(response.text))

I am getting the error:
<Response [400]>
{'error': {'ids': ["Wanted type [Integer] but got '5'"]}}

Possible Solution

This error could possibly be because I am using python, I checked and I am using a integer type for sure. In one of my tests of this code, I even tried to wrap a number I was using as the value for 'ids' with int() and still got the same issue.
My thoughts were that I possibly have the wrong url or that the way that I have written out my parameters in calling post is wrong?

Your Environment

  • Environment name and version (e.g. Chrome 39, node.js 5.4): Python 3.0
  • Operating System and version (desktop or mobile): Apple 13.3 inch Intel processor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant