Skip to main content

API USER


Forum|alt.badge.img

How to create API User on Sand Box

 

# %%
import requests as rq
import json
import uuid
url = "https://sandbox.momodeveloper.mtn.com/v1_0/apiuser"
API_USER = str(uuid.uuid4())
headers = {
    "X-Reference-Id": API_USER,
    "Ocp-Apim-Subscription-Key": "4c91dae7a6f1474387a23a1f3d448eb7",
    "Content-Type": "application/json"
}
body = {
    "providerCallbackHost": "webhook.site"
}
resp = rq.request("post", url, json=body, headers=headers)
print(resp.status_code,"\n API USER Is",API_USER)



# %%
url = "https://sandbox.momodeveloper.mtn.com/v1_0/apiuser/"+API_USER+"/apikey"

headers = {
    "Ocp-Apim-Subscription-Key": "4c91dae7a6f1474387a23a1f3d448eb7",
    "Content-Type": "application/json"
}

resp = rq.request("post", url, headers=headers)
print(resp.status_code,"\nAPI User is ",API_USER)
jsn = resp.text.split(":")
API_KEY = str(jsn[1].replace("}","")).replace("\"","")
print("API Key is ", API_KEY)


 

This topic has been closed for comments

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings