0

I'm using Python to interface to a web service which receives http post messages. For one particular service, the documentation reads:

Parameters:

Name               Type           Value
meteringPointIds   String array   List of metering point ids

HTTP verb: POST

I only have one metering point id, so I'm using this construction:

postData = {'meteringPointIds': meteringPointId}
r = requests.post( url + path, headers=headers, json=postData)

The variable meteringPointId contains a string with the metering point id.

#20013: No meteringpoints in request conforms to valid meteringpoint format.

Let's say the metering point id is 1234. I've tried

postData = {'meteringPointIds': 1234}
postData = {'meteringPointIds': [1234]}
postData = {'meteringPointIds': ['1234']}
postData = {'meteringPointIds': '[1234]'}
postData = {'meteringPointIds': ["1234"]}
postData = {'meteringPointIds': "[1234]"}

But no matter what I do, I always get the above error. What am I missing?

Web service documentation:

Customer and Third party API for Datahub Eloverblik Technical description

API - Data Description

3
  • it totally depends on endpoint you are using. Commented Jun 17, 2021 at 16:35
  • 1
    Can you post the link to the web service's documentation that you mentioned? Commented Jun 17, 2021 at 16:47
  • I've added links to the two documents provided. Commented Jun 17, 2021 at 18:03

2 Answers 2

1

Try this JSON:

postData = {
    "meteringPoints": {
        "meteringPoint": [
            "1234"
        ]
    }
}

or, maybe

postData = {
    "meteringPointIds": {
        "meteringPoints": {
            "meteringPoint": [
                "1234"
            ]
        }
    }
}
Sign up to request clarification or add additional context in comments.

1 Comment

Amazing - your first suggestion worked! Thanks! :-)
1

Try a string with comma-separated values. I don't think you need a comma for just one value.

postData = {'meteringPointIds': "1234"}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.