0
votes

I am attempting to use the Create Contacts endpoint for Microsoft Graph API (Doc is here: https://docs.microsoft.com/en-us/graph/api/user-post-contacts?view=graph-rest-1.0&tabs=http) to register new contact for my user. I created body as described in API documentation but getting the error below:

{
    "error": {
        "code": "Request_BadRequest",
        "message": "A value without a type name was found and no expected type is available. When the model is specified, each value in the payload must have a type which can be either specified in the payload, explicitly by the caller or implicitly inferred from the parent value.",
        "innerError": {
            "request-id": "daf78520-50e6-444b-97a2-779762b3e6ed",
            "date": "2020-01-23T14:20:18"
        }
    }
}

Requests used: 1. POST https://graph.microsoft.com/v1.0/{{tenant_id}}/contacts; 2. POST https://graph.microsoft.com/v1.0/me/contacts; Request body example:

{
  "givenName": "Yulia",
  "surname": "Lukianenko",
  "emailAddresses": [
    {
      "address": "[email protected]",
      "name": "Yulia Lukianenko"
    }
  ],
  "businessPhones": [
    "+1 732 555 0102"
  ]
}

Did somebody meet such kind of issue? How you resolved it?

Thank you in advance for your help!

1
That payload is fine, I just used it to POST to /me/contacts. Your first POST attempt won't work though, that URL isn't valid. You can't use a tenant ID. Have you tried making this request in Graph Explorer?Jason Johnston
Jason Johnston, thank you for you reply! The behavior in Graph Explorer is the same. I suspect that this is problem with my license. What type of license do you use? Thank you in advance!Yuliia Lukianenko

1 Answers

0
votes

POST request is incorrect here. It should be : https://graph.microsoft.com/v1.0/me/contacts

Also you need to make sure "Contacts.ReadWrite" permission is granted to the app registered in AAD.

P.S: I used the same JSON in your example using graphExplorer and contact was created successfully.